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

(-)a/Koha/REST/V1.pm (-3 / +3 lines)
Lines 83-93 sub authenticate_api_request { Link Here
83
        );
83
        );
84
    }
84
    }
85
85
86
    if ($action_spec->{'x-koha-permission'}) {
86
    if ($action_spec->{'x-koha-authorization'}) {
87
        if (_allowOwner($c, $action_spec, $user)) {
87
        if (_allowOwner($c, $action_spec, $user)) {
88
            return $next->($c);
88
            return $next->($c);
89
        }
89
        }
90
        my $permissions = $action_spec->{'x-koha-permission'}->{'permissions'};
90
        my $permissions = $action_spec->{'x-koha-authorization'}->{'permissions'};
91
91
92
        if (C4::Auth::haspermission($user->userid, $permissions)) {
92
        if (C4::Auth::haspermission($user->userid, $permissions)) {
93
            return $next->($c);
93
            return $next->($c);
Lines 108-114 sub authenticate_api_request { Link Here
108
sub _allowOwner {
108
sub _allowOwner {
109
    my ($c, $action_spec, $user) = @_;
109
    my ($c, $action_spec, $user) = @_;
110
110
111
    my $allowOwner = $action_spec->{'x-koha-permission'}->{'allow-owner'};
111
    my $allowOwner = $action_spec->{'x-koha-authorization'}->{'allow-owner'};
112
112
113
    return unless $allowOwner && $allowOwner == 1;
113
    return unless $allowOwner && $allowOwner == 1;
114
    if ($c->param("borrowernumber")) {
114
    if ($c->param("borrowernumber")) {
(-)a/api/v1/swagger/paths/holds.json (-4 / +4 lines)
Lines 22-28 Link Here
22
          }
22
          }
23
        }
23
        }
24
      },
24
      },
25
      "x-koha-permission": {
25
      "x-koha-authorization": {
26
        "allow-owner": "1",
26
        "allow-owner": "1",
27
        "permissions": {
27
        "permissions": {
28
          "borrowers": "1"
28
          "borrowers": "1"
Lines 99-105 Link Here
99
          }
99
          }
100
        }
100
        }
101
      },
101
      },
102
      "x-koha-permission": {
102
      "x-koha-authorization": {
103
        "allow-owner": "1",
103
        "allow-owner": "1",
104
        "permissions": {
104
        "permissions": {
105
          "reserveforothers": "1"
105
          "reserveforothers": "1"
Lines 161-167 Link Here
161
          }
161
          }
162
        }
162
        }
163
      },
163
      },
164
      "x-koha-permission": {
164
      "x-koha-authorization": {
165
        "permissions": {
165
        "permissions": {
166
          "reserveforothers": "1"
166
          "reserveforothers": "1"
167
        }
167
        }
Lines 189-195 Link Here
189
          }
189
          }
190
        }
190
        }
191
      },
191
      },
192
      "x-koha-permission": {
192
      "x-koha-authorization": {
193
        "permissions": {
193
        "permissions": {
194
          "reserveforothers": "1"
194
          "reserveforothers": "1"
195
        }
195
        }
(-)a/api/v1/swagger/paths/patrons.json (-3 / +2 lines)
Lines 23-29 Link Here
23
          }
23
          }
24
        }
24
        }
25
      },
25
      },
26
      "x-koha-permission": {
26
      "x-koha-authorization": {
27
        "permissions": {
27
        "permissions": {
28
            "borrowers": "1"
28
            "borrowers": "1"
29
        }
29
        }
Lines 61-67 Link Here
61
          }
61
          }
62
        }
62
        }
63
      },
63
      },
64
      "x-koha-permission": {
64
      "x-koha-authorization": {
65
        "allow-owner": "1",
65
        "allow-owner": "1",
66
        "permissions": {
66
        "permissions": {
67
            "borrowers": "1"
67
            "borrowers": "1"
68
- 

Return to bug 14868