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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-2 / +2 lines)
Lines 203-210 Patrons: Link Here
203
         - pref: ProtectSuperlibrarianPrivileges
203
         - pref: ProtectSuperlibrarianPrivileges
204
           choices:
204
           choices:
205
               yes: Allow only superlibrarians
205
               yes: Allow only superlibrarians
206
               no: Do not block permitted non-superlibrarians
206
               no: Allow all permitted users
207
         - to access/change superlibrarian privileges.
207
         - "to access/change superlibrarian privileges. Note: A permitted user needs to have the 'permissions' flag (if no superlibrarian)."
208
208
209
    "Norwegian patron database":
209
    "Norwegian patron database":
210
     -
210
     -
(-)a/members/member-flags.pl (-12 / +6 lines)
Lines 84-101 if ($input->param('newflags')) { Link Here
84
    }
84
    }
85
    
85
    
86
    $sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?");
86
    $sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?");
87
    if( !C4::Context->preference('ProtectSuperlibrarianPrivileges') || C4::Context->IsSuperLibrarian ) {
87
    my $old_flags = $patron->flags // 0;
88
        $sth->execute($module_flags, $member);
88
    if( ( $old_flags == 1 || $module_flags == 1 ) &&
89
    } else {
89
      $old_flags != $module_flags ) {
90
        my $old_flags = $patron->flags // 0;
90
        die "Non-superlibrarian is changing superlibrarian privileges" if !C4::Context->IsSuperLibrarian && C4::Context->preference('ProtectSuperlibrarianPrivileges'); # Interface should not allow this, so we can just die here
91
        if( ( $old_flags == 1 || $module_flags == 1 ) &&
92
              $old_flags != $module_flags ) {
93
           die "Non-superlibrarian is changing superlibrarian privileges"; # Interface should not allow this, so we can just die here
94
        } else {
95
            $sth->execute($module_flags, $member);
96
        }
97
    }
91
    }
98
    
92
    $sth->execute($module_flags, $member);
93
99
    # deal with subpermissions
94
    # deal with subpermissions
100
    $sth = $dbh->prepare("DELETE FROM user_permissions WHERE borrowernumber = ?");
95
    $sth = $dbh->prepare("DELETE FROM user_permissions WHERE borrowernumber = ?");
101
    $sth->execute($member); 
96
    $sth->execute($member); 
102
- 

Return to bug 20100