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

(-)a/Koha/Patron.pm (+15 lines)
Lines 1909-1914 sub queue_notice { Link Here
1909
    return \%return;
1909
    return \%return;
1910
}
1910
}
1911
1911
1912
=head3 can_patron_change_staff_only_lists
1913
1914
$patron->can_patron_change_staff_only_lists;
1915
1916
Return 1 if a patron has 'Superlibrarian' or 'Catalogue' permission.
1917
Otherwise, return 0.
1918
1919
=cut
1920
1921
sub can_patron_change_staff_only_lists {
1922
    my ( $self, $params ) = @_;
1923
    return 1 if C4::Auth->haspermission( $self->userid, { 'catalogue' => 1 });
1924
    return 0;
1925
}
1926
1912
=head2 Internal methods
1927
=head2 Internal methods
1913
1928
1914
=head3 _type
1929
=head3 _type
(-)a/Koha/Virtualshelf.pm (-12 / +4 lines)
Lines 184-194 sub add_biblio { Link Here
184
    )->count;
184
    )->count;
185
    return if $already_exists;
185
    return if $already_exists;
186
186
187
    my $patron = Koha::Patrons->find( $borrowernumber );
188
    my $staffuser = 1 if ( C4::Auth::haspermission( $patron->userid, {'catalogue' => 1 }) );
189
190
    # Check permissions
187
    # Check permissions
191
    return unless ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) || ( $self->allow_change_from_staff && $staffuser ) || $self->allow_change_from_others;
188
    return unless ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) || ( $self->allow_change_from_staff && Koha::Patrons->find( $borrowernumber )->can_patron_change_staff_only_lists ) || $self->allow_change_from_others;
192
189
193
    my $content = Koha::Virtualshelfcontent->new(
190
    my $content = Koha::Virtualshelfcontent->new(
194
        {
191
        {
Lines 209-219 sub remove_biblios { Link Here
209
    my $borrowernumber = $params->{borrowernumber};
206
    my $borrowernumber = $params->{borrowernumber};
210
    return unless @$biblionumbers;
207
    return unless @$biblionumbers;
211
208
212
    my $patron = Koha::Patrons->find( $borrowernumber );
213
    my $staffuser = 1 if ( haspermission( $patron->userid, {'catalogue' => 1 }));
214
    my $number_removed = 0;
209
    my $number_removed = 0;
215
    if( ( $self->owner == $borrowernumber && $self->allow_change_from_owner )
210
    if( ( $self->owner == $borrowernumber && $self->allow_change_from_owner )
216
      || ( $staffuser && $self->allow_change_from_staff )
211
      || ( $self->allow_change_from_staff && Koha::Patrons->find( $borrowernumber )->can_patron_change_staff_only_lists )
217
      || $self->allow_change_from_others ) {
212
      || $self->allow_change_from_others ) {
218
        $number_removed += $self->get_contents->search({
213
        $number_removed += $self->get_contents->search({
219
            biblionumber => $biblionumbers,
214
            biblionumber => $biblionumbers,
Lines 242-248 sub can_be_deleted { Link Here
242
237
243
    my $patron = Koha::Patrons->find( $borrowernumber );
238
    my $patron = Koha::Patrons->find( $borrowernumber );
244
239
245
    return 1 if $self->is_public and C4::Auth::haspermission( $patron->userid, { lists => 'delete_public_lists' } );
240
    return 1 if $self->is_public and haspermission( $patron->userid, { lists => 'delete_public_lists' } );
246
241
247
    return 0;
242
    return 0;
248
}
243
}
Lines 257-268 sub can_be_managed { Link Here
257
sub can_biblios_be_added {
252
sub can_biblios_be_added {
258
    my ( $self, $borrowernumber ) = @_;
253
    my ( $self, $borrowernumber ) = @_;
259
254
260
    my $patron = Koha::Patrons->find( $borrowernumber );
261
    my $staffuser = 1 if ( C4::Auth::haspermission( $patron->userid, {'catalogue' => 1 } ));
262
263
    return 1
255
    return 1
264
      if $borrowernumber
256
      if $borrowernumber
265
      and ( ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) or ( $self->allow_change_from_staff && $staffuser ) or $self->allow_change_from_others );
257
      and ( ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) or ( $self->allow_change_from_staff && Koha::Patrons->find( $borrowernumber )->can_patron_change_staff_only_lists ) or $self->allow_change_from_others );
266
    return 0;
258
    return 0;
267
}
259
}
268
260
(-)a/Koha/Virtualshelves.pm (-3 / +1 lines)
Lines 90-98 sub get_some_shelves { Link Here
90
90
91
    my @conditions;
91
    my @conditions;
92
    if ( $add_allowed ) {
92
    if ( $add_allowed ) {
93
        my $patron = Koha::Patrons->find( $borrowernumber );
93
        if ( Koha::Patrons->find( $borrowernumber )->can_patron_change_staff_only_lists ) {
94
        my $staffuser = haspermission( $patron->userid, {'catalogue' => 1});
95
        if ( $staffuser ) {
96
            push @conditions, {
94
            push @conditions, {
97
                -or =>
95
                -or =>
98
                [
96
                [
(-)a/opac/opac-addbybiblionumber.pl (-3 / +1 lines)
Lines 119-126 if ($newvirtualshelf) { Link Here
119
            { join => 'virtualshelfshares', }
119
            { join => 'virtualshelfshares', }
120
        );
120
        );
121
        my $public_shelves;
121
        my $public_shelves;
122
        my $logged_in_patron = Koha::Patrons->find( $loggedinuser );
122
        if ( Koha::Patrons->find( $borrowernumber )->can_patron_change_staff_only_lists ) {
123
        if ( haspermission( $logged_in_patron->userid, {'catalogue' => 1})) {
124
            $public_shelves = Koha::Virtualshelves->search(
123
            $public_shelves = Koha::Virtualshelves->search(
125
                {   category => 2,
124
                {   category => 2,
126
                    -or      => [
125
                    -or      => [
127
- 

Return to bug 26346