Bugzilla – Attachment 159654 Details for
Bug 30230
Search for patrons in checkout should not require edit_borrowers permission
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30230: Add new 'list_borrowers' permission
Bug-30230-Add-new-listborrowers-permission.patch (text/plain), 8.62 KB, created by
ByWater Sandboxes
on 2023-12-07 15:34:38 UTC
(
hide
)
Description:
Bug 30230: Add new 'list_borrowers' permission
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2023-12-07 15:34:38 UTC
Size:
8.62 KB
patch
obsolete
>From 11b114b0debc368c2e04741bc762fc710c17fb8f Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Thu, 30 Nov 2023 15:14:42 +0100 >Subject: [PATCH] Bug 30230: Add new 'list_borrowers' permission > >When a patron search is performed only a user with edit_borrowers >permission can search by name. Search can works only with cardnumber but >it makes searching less intuitive I think. > >So, as mentioned in the discussion, I've added a new 'list_borrowers' permission, >completely independent of 'edit_borrowers', so that I can search for a member via the interface >and get the results. In addition to the permission to perform check in and checkouts, this no longer poses an obstacle to simple use. > >Test plan: > >1) Check with a user without 'edit_borrowers' permission that the patron search can only be performed with cardnumber >2) Apply this patch >3) Make the updatedatabase to add new 'list_borrowers' permissions >4) Set 'list_borrowers' permission on one user and see the difference > >Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> >--- > api/v1/swagger/paths/patrons.yaml | 1 + > ...ug_30230_add-new-list-borrowers-permission.pl | 16 ++++++++++++++++ > .../data/mysql/mandatory/userpermissions.sql | 1 + > .../prog/en/includes/patron-search-header.inc | 8 +++++--- > .../prog/en/includes/permissions.inc | 5 +++++ > .../prog/en/modules/intranet-main.tt | 2 +- > members/member.pl | 2 +- > members/members-home.pl | 2 +- > members/moremember.pl | 2 +- > 9 files changed, 32 insertions(+), 7 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_30230_add-new-list-borrowers-permission.pl > >diff --git a/api/v1/swagger/paths/patrons.yaml b/api/v1/swagger/paths/patrons.yaml >index cf8aa09122..7238d286b9 100644 >--- a/api/v1/swagger/paths/patrons.yaml >+++ b/api/v1/swagger/paths/patrons.yaml >@@ -397,6 +397,7 @@ > - tools: "label_creator" > - serials: "routing" > - acquisition: "order_manage" >+ - borrowers: "list_borrowers" > post: > x-mojo-to: Patrons#add > operationId: addPatron >diff --git a/installer/data/mysql/atomicupdate/bug_30230_add-new-list-borrowers-permission.pl b/installer/data/mysql/atomicupdate/bug_30230_add-new-list-borrowers-permission.pl >new file mode 100755 >index 0000000000..88772b4886 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_30230_add-new-list-borrowers-permission.pl >@@ -0,0 +1,16 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "BUG_30230", >+ description => "Add new list_borrowers permission", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ "INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (4, 'list_borrowers', 'Search and list patrons')" >+ ); >+ >+ say $out "Added new permission 'list_borrowers'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql >index 9660879f86..2f5451f089 100644 >--- a/installer/data/mysql/mandatory/userpermissions.sql >+++ b/installer/data/mysql/mandatory/userpermissions.sql >@@ -45,6 +45,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 3, 'manage_identity_providers', 'Manage identity providers'), > ( 4, 'delete_borrowers', 'Delete patrons'), > ( 4, 'edit_borrowers', 'Add, modify and view patron information'), >+ ( 4, 'list_borrowers', 'Search and list patrons'), > ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'), > ( 6, 'place_holds', 'Place holds for patrons'), > ( 6, 'modify_holds_priority', 'Modify holds priority'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc >index b3a21080be..cbb8c8bda9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc >@@ -14,9 +14,11 @@ > [% END %] > </div><!-- /.tab-content --> > <ul class="nav nav-tabs" role="tablist"> >- <li role="presentation" class="active"> >- <a title="Search patrons" href="#patron_search" aria-controls="patron_search" role="tab" aria-expanded="true" data-toggle="tab" class="keep_text"><i class="fa fa-fw fa-id-card" aria-hidden="true"></i> <span class="tab-title">Search patrons</span></a> >- </li> >+ [% IF ( CAN_user_circulate ) %] >+ <li role="presentation" class="active"> >+ <a title="Search patrons" href="#patron_search" aria-controls="patron_search" role="tab" aria-expanded="true" data-toggle="tab" class="keep_text"><i class="fa fa-fw fa-id-card" aria-hidden="true"></i> <span class="tab-title">Search patrons</span></a> >+ </li> >+ [% END %] > [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %] > <li role="presentation"> > <a title="Check out" href="#circ_search" aria-controls="circ_search" role="tab" data-toggle="tab" class="keep_text"><i class="fa fa-fw fa-upload" aria-hidden="true"></i> <span class="tab-title"><span class="tab-title">Check out</span></span></a> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >index 3d0af47233..0959951037 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >@@ -312,6 +312,11 @@ > Add, modify and view patron information > </span> > <span class="permissioncode">([% name | html %])</span> >+ [%- CASE 'list_borrowers' -%] >+ <span class="sub_permission list_borrowers_subpermission"> >+ Search and list patrons >+ </span> >+ <span class="permissioncode">([% name | html %])</span> > [%- CASE 'view_borrower_infos_from_any_libraries' -%] > <span class="sub_permission view_borrower_infos_from_any_libraries_subpermission"> > View patron infos from any libraries. If not set the logged in user could only access patron infos from its own library or group of libraries. >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >index c066fe3ace..845d7759eb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >@@ -64,7 +64,7 @@ > </li> > [% END %] > >- [% IF CAN_user_borrowers_edit_borrowers %] >+ [% IF (CAN_user_borrowers_edit_borrowers) || (CAN_user_borrowers_list_borrowers) %] > <li> > <a class="icon_general icon_patrons" href="/cgi-bin/koha/members/members-home.pl"><i class="fa fa-fw fa-id-card"></i>Patrons</a> > </li> >diff --git a/members/member.pl b/members/member.pl >index 30ba11bc8c..6f63ec5166 100755 >--- a/members/member.pl >+++ b/members/member.pl >@@ -37,7 +37,7 @@ my ($template, $loggedinuser, $cookie) > = get_template_and_user({template_name => "members/member.tt", > query => $input, > type => "intranet", >- flagsrequired => {borrowers => 'edit_borrowers'}, >+ flagsrequired => { borrowers => ['edit_borrowers', 'list_borrowers'] }, > }); > > my $theme = $input->param('theme') || "default"; >diff --git a/members/members-home.pl b/members/members-home.pl >index 22d341bbbb..ae0a7b1d57 100755 >--- a/members/members-home.pl >+++ b/members/members-home.pl >@@ -35,7 +35,7 @@ my ($template, $loggedinuser, $cookie, $flags) > = get_template_and_user({template_name => "members/member.tt", > query => $query, > type => "intranet", >- flagsrequired => {borrowers => 'edit_borrowers'}, >+ flagsrequired => { borrowers => ['edit_borrowers', 'list_borrowers'] }, > }); > > my $no_add = 0; >diff --git a/members/moremember.pl b/members/moremember.pl >index 7a419e9fb9..2f70c48705 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -62,7 +62,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > template_name => $template_name, > query => $input, > type => "intranet", >- flagsrequired => { borrowers => 'edit_borrowers' }, >+ flagsrequired => { borrowers => ['edit_borrowers', 'list_borrowers'] }, > } > ); > my $borrowernumber = $input->param('borrowernumber'); >-- >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 30230
:
159409
|
159412
|
159427
|
159517
|
159559
|
159613
|
159633
|
159654
|
159667
|
159668
|
159933
|
159988
|
159989
|
159990
|
159991
|
159992
|
161068
|
161240
|
161241
|
161242
|
161243
|
161245
|
161246
|
161250
|
161251