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

(-)a/Koha/REST/V1/CirculationRules.pm (-1 / +1 lines)
Lines 52-58 sub save_rules { Link Here
52
    my $schema = Koha::Database->new->schema;
52
    my $schema = Koha::Database->new->schema;
53
53
54
    my $uid = $c->stash( 'koha.user' )->userid;
54
    my $uid = $c->stash( 'koha.user' )->userid;
55
    my $restricted_to_library = $uid && haspermission( $uid, { parameters => 'manage_circ_rules_restricted' }, { no_inherit => 1 } ) ? $c->stash( 'koha.user' )->branchcode : "";
55
    my $restricted_to_library = $uid && haspermission( $uid, { parameters => 'manage_circ_rules_from_any_libraries' } ) ? "" : $c->stash( 'koha.user' )->branchcode;
56
56
57
    return try {
57
    return try {
58
        my $rules = $c->req->json;
58
        my $rules = $c->req->json;
(-)a/admin/policy.pl (-1 / +1 lines)
Lines 41-47 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
41
);
41
);
42
42
43
my $uid = Koha::Patrons->find( $borrowernumber )->userid;
43
my $uid = Koha::Patrons->find( $borrowernumber )->userid;
44
my $restricted_to_own_library = $uid && haspermission( $uid, { parameters => 'manage_circ_rules_restricted' }, { no_inherit => 1 } );
44
my $restricted_to_own_library = !( $uid && haspermission( $uid, { parameters => 'manage_circ_rules_from_any_libraries' } ) );
45
$template->param( restricted_to_library => $restricted_to_own_library ? C4::Context::mybranch() : "" );
45
$template->param( restricted_to_library => $restricted_to_own_library ? C4::Context::mybranch() : "" );
46
46
47
output_html_with_http_headers $query, $cookie, $template->output;
47
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/t/db_dependent/api/v1/circ_rules.t (-3 / +2 lines)
Lines 253-263 sub create_user_and_session { Link Here
253
    $session->param( 'lasttime', time() );
253
    $session->param( 'lasttime', time() );
254
    $session->flush;
254
    $session->flush;
255
255
256
    if ( $args->{permissions} eq 'authorized_restricted' ) {
256
    if ( $args->{permissions} ne 'authorized_restricted' ) {
257
        $dbh->do(
257
        $dbh->do(
258
            q{
258
            q{
259
            INSERT INTO user_permissions (borrowernumber,module_bit,code)
259
            INSERT INTO user_permissions (borrowernumber,module_bit,code)
260
            VALUES (?,3,'manage_circ_rules_restricted'), (?,3,'manage_circ_rules')},
260
            VALUES (?,3,'manage_circ_rules_from_any_libraries'), (?,3,'manage_circ_rules')},
261
            undef, $user->{borrowernumber}, $user->{borrowernumber}
261
            undef, $user->{borrowernumber}, $user->{borrowernumber}
262
        );
262
        );
263
    }
263
    }
264
- 

Return to bug 15522