|
Lines 104-114
sub authenticate_api_request {
Link Here
|
| 104 |
); |
104 |
); |
| 105 |
} |
105 |
} |
| 106 |
|
106 |
|
| 107 |
if ($action_spec->{'x-koha-permission'}) { |
107 |
if ($action_spec->{'x-koha-authorization'}) { |
| 108 |
if (_allowOwner($c, $action_spec, $user)) { |
108 |
if (_allowOwner($c, $action_spec, $user)) { |
| 109 |
return $next->($c); |
109 |
return $next->($c); |
| 110 |
} |
110 |
} |
| 111 |
my $permissions = $action_spec->{'x-koha-permission'}->{'permissions'}; |
111 |
my $permissions = $action_spec->{'x-koha-authorization'}->{'permissions'}; |
| 112 |
|
112 |
|
| 113 |
if (C4::Auth::haspermission($user->userid, $permissions)) { |
113 |
if (C4::Auth::haspermission($user->userid, $permissions)) { |
| 114 |
return $next->($c); |
114 |
return $next->($c); |
|
Lines 129-135
sub authenticate_api_request {
Link Here
|
| 129 |
sub _allowOwner { |
129 |
sub _allowOwner { |
| 130 |
my ($c, $action_spec, $user) = @_; |
130 |
my ($c, $action_spec, $user) = @_; |
| 131 |
|
131 |
|
| 132 |
my $allowOwner = $action_spec->{'x-koha-permission'}->{'allow-owner'}; |
132 |
my $allowOwner = $action_spec->{'x-koha-authorization'}->{'allow-owner'}; |
| 133 |
|
133 |
|
| 134 |
return unless $allowOwner && $allowOwner == 1; |
134 |
return unless $allowOwner && $allowOwner == 1; |
| 135 |
if ($c->param("borrowernumber")) { |
135 |
if ($c->param("borrowernumber")) { |