Bugzilla – Attachment 126280 Details for
Bug 20813
Revamp user permissions system
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20813: Remove flags references from Patron.pm, fix method has_permission
Bug-20813-Remove-flags-references-from-Patronpm-fi.patch (text/plain), 2.38 KB, created by
Kyle M Hall (khall)
on 2021-10-14 13:57:28 UTC
(
hide
)
Description:
Bug 20813: Remove flags references from Patron.pm, fix method has_permission
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-10-14 13:57:28 UTC
Size:
2.38 KB
patch
obsolete
>From 495c98466d2c05e900bd2fe4c5f81783cae71aa4 Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Thu, 14 Oct 2021 09:57:15 -0400 >Subject: [PATCH] Bug 20813: Remove flags references from Patron.pm, fix method > has_permission > >--- > Koha/Patron.pm | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 731acdc03c4..9c736e213e3 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1671,7 +1671,7 @@ sub anonymize { > split /\s*\|\s*/, C4::Context->preference('BorrowerMandatoryField') }; > $mandatory->{userid} = 1; # needed since sub store does not clear field > my @columns = $self->_result->result_source->columns; >- @columns = grep { !/borrowernumber|branchcode|categorycode|^date|password|flags|updated_on|lastseen|lang|login_attempts|anonymized/ } @columns; >+ @columns = grep { !/borrowernumber|branchcode|categorycode|^date|password|updated_on|lastseen|lang|login_attempts|anonymized/ } @columns; > push @columns, 'dateofbirth'; # add this date back in > foreach my $col (@columns) { > $self->_anonymize_column($col, $mandatory->{lc $col} ); >@@ -1796,7 +1796,6 @@ sub to_api_mapping { > debarred => undef, # replaced by 'restricted' > debarredcomment => undef, # calculated, API consumers will use /restrictions instead > emailpro => 'secondary_email', >- flags => undef, # permissions manipulation handled in /permissions > gonenoaddress => 'incorrect_address', > guarantorid => 'guarantor_id', > lastseen => 'last_seen', >@@ -1913,6 +1912,7 @@ sub queue_notice { > > =head3 has_permission > >+my $bool = $patron->has_permission( { $top_level_perm => $sub_perm } ); > my $bool = $patron->has_permission( $permission_code ); > > =cut >@@ -1920,12 +1920,17 @@ my $bool = $patron->has_permission( $permission_code ); > sub has_permission { > my ( $self, $code ) = @_; > >- return Koha::Patron::Permissions->find( >+ if ( ref $code eq 'HASH' ) { >+ my ( $pri, $sec ) = %$code; >+ $code = $sec eq '1' ? $pri : { '-in' => [ $pri, $sec ] }; >+ } >+ >+ return Koha::Patron::Permissions->search( > { > borrowernumber => $self->id, > code => $code, > } >- ) ? 1 : 0; >+ )->count; > } > > =head3 set_permissions >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20813
:
75542
|
75543
|
75544
|
75545
|
124834
|
124835
|
124836
|
126280
|
126281
|
126282
|
126283
|
126284
|
126285
|
126287
|
126288
|
126289