View | Details | Raw Unified | Return to bug 24067
Collapse All | Expand All

(-)a/Koha/REST/V1/Patrons.pm (+15 lines)
Lines 465-470 sub _to_model { Link Here
465
    return $patron;
465
    return $patron;
466
}
466
}
467
467
468
sub owner_authorization {
469
    my ($c, $method, $user) = @_;
470
471
    if ($method eq 'guarantors_can_see_charges') {
472
        my $patron_id = $c->match->stack->[-1]->{'patron_id'};
473
        return $user->borrowernumber == $patron_id ? 1 : 0;
474
    }
475
    elsif ($method eq 'guarantors_can_see_checkouts') {
476
        my $patron_id = $c->match->stack->[-1]->{'patron_id'};
477
        return $user->borrowernumber == $patron_id ? 1 : 0;
478
    }
479
480
    return 0;
481
}
482
468
=head2 Global variables
483
=head2 Global variables
469
484
470
=head3 $to_api_mapping
485
=head3 $to_api_mapping
(-)a/Koha/REST/V1/Patrons/Password.pm (-1 / +11 lines)
Lines 135-138 sub set_public { Link Here
135
    };
135
    };
136
}
136
}
137
137
138
sub owner_authorization {
139
    my ($c, $method, $user, $auth_spec) = @_;
140
141
    if ($method eq 'set_public') {
142
        my $patron_id = $c->match->stack->[-1]->{'patron_id'};
143
        return $user->borrowernumber == $patron_id ? 1 : 0;
144
    }
145
146
    return 0;
147
}
148
138
1;
149
1;
139
- 

Return to bug 24067