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

(-)a/C4/Auth.pm (-7 / +18 lines)
Lines 1715-1727 sub get_user_subpermissions { Link Here
1715
    my $userid = shift;
1715
    my $userid = shift;
1716
    return {} unless $userid;
1716
    return {} unless $userid;
1717
1717
1718
    use Koha::Auth::PermissionManager;
1719
    my $permissionManager = Koha::Auth::PermissionManager->new();
1720
    my $borrowerPermissions = $permissionManager->getBorrowerPermissions($userid); #Prefetch all related tables.
1721
    my $user_perms = {};
1718
    my $user_perms = {};
1722
    foreach my $perm ( @$borrowerPermissions ) {
1719
    try {
1723
        $user_perms->{ $perm->getPermissionModule->module }->{ $perm->getPermission->code } = 1;
1720
        use Koha::Auth::PermissionManager;
1724
    }
1721
        my $permissionManager = Koha::Auth::PermissionManager->new();
1722
        my $borrowerPermissions = $permissionManager->getBorrowerPermissions($userid); #Prefetch all related tables.
1723
        foreach my $perm ( @$borrowerPermissions ) {
1724
            $user_perms->{ $perm->getPermissionModule->module }->{ $perm->getPermission->code } = 1;
1725
        }
1726
    } catch {
1727
        if (blessed($_) && $_->isa('Koha::Exception::UnknownObject')) {
1728
            return $user_perms;
1729
        }
1730
        elsif (blessed($_)) {
1731
            $_->rethrow();
1732
        }
1733
        else {
1734
            die $_;
1735
        }
1736
    };
1725
1737
1726
    return $user_perms;
1738
    return $user_perms;
1727
}
1739
}
1728
- 

Return to bug 14540