Bugzilla – Attachment 142269 Details for
Bug 30624
Add a permission to control the ability to change the logged in library
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30624: Add select_loggedin_library permission
Bug-30624-Add-selectloggedinlibrary-permission.patch (text/plain), 11.95 KB, created by
Lucas Gass (lukeg)
on 2022-10-20 16:57:25 UTC
(
hide
)
Description:
Bug 30624: Add select_loggedin_library permission
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2022-10-20 16:57:25 UTC
Size:
11.95 KB
patch
obsolete
>From d7edfc1b96adb2d7f18957c85fce7d09536c9197 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Mon, 13 Jun 2022 22:06:50 +0000 >Subject: [PATCH] Bug 30624: Add select_loggedin_library permission > >To test: >1. Apply patch, updatedatabase, restart_all >2. Have a user with superlibrarian privileges ( User1 ) >3. Have a user who has staff access and circulate privileges but is not a super librarian. ( User2 ) Make note of this users home library >4. Turn on the system preference 'CircSidebar'. > >-MAIN log in ( auth.tt ) >5. As User1, go to the main login screen and try logging in. You should be able to log in AND you should be able to properly chnage your branch BEFORE logging in. >6. As User2, to to the main login screnn amd try logging in. You should be able to but if you try and switch your libraray to anything beside the user's home branch it will not work. You will be logged in at your home branch. >7. For User2, set the new permission 'select_loggedin_library' on. >8. Now you should be able to successfully switch libraries before log in. >9. Turn the 'select_loggedin_library' back off for User2. > >-AFTER log in- >10. With User1, click on your name/branch in the top right, you should see the the link 'Set library' at the top. If you turn on 'UseCirculationDesks' the link will be 'Set library and desk'. >11. With User2, click on your name/branch in the top right. If you have 'UseCirculationDesks' on, you should see 'Set desk', otherwise you should see nothing. >12. Repeat step 7. >13. NOw if you click on your name/branch in the top right, you should see the the link 'Set library' at the top. If you turn on 'UseCirculationDesks' the link will be 'Set library and desk'. >14. Repeat Step 9. > >-CircSideBar- >15. With 'CircSideBar' turned on, go to any ciculation page (Holds queue, Holds to pull, Holds awaiting pickup) with User1. You will see the 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set library and desk'. >16. Try with User2 and you will not see a 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set desk' link. >17. Repeat step 7. >18. For with User2 you go to any ciculation page (Holds queue, Holds to pull, Holds awaiting pickup). You will see the 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set library and desk'. >19. Repeat step 9. > >-Set library page- >20. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User1. You will see a dropdown for 'Set library'. Make sure you can change your library successfully. >21. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User2. You should NOT see see a dropdown for 'Set library'. >22. Repeat step 7. >23. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User2. Now you should see a dropdown for 'Set library'. > >Signed-off-by: Andrew <andrewfh@gmail.com> >--- > C4/Auth.pm | 4 ++-- > .../data/mysql/mandatory/userpermissions.sql | 1 + > .../prog/en/includes/circ-nav.inc | 18 ++++++-------- > .../intranet-tmpl/prog/en/includes/header.inc | 2 +- > .../prog/en/includes/permissions.inc | 5 ++++ > .../prog/en/modules/circ/circulation-home.tt | 8 ++++++- > .../prog/en/modules/circ/set-library.tt | 24 ++++++++++++++----- > 7 files changed, 41 insertions(+), 21 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index a006baa8d8..30dd8214ae 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -1147,10 +1147,10 @@ sub checkauth { > my $ip = $ENV{'REMOTE_ADDR'}; > > # if they specify at login, use that >- if ( $query->param('branch') ) { >+ if ( $query->param('branch') && ( haspermission($userid, { parameters => 'select_loggedin_library' }) || $flags->{superlibrarian}) ) { > $branchcode = $query->param('branch'); > my $library = Koha::Libraries->find($branchcode); >- $branchname = $library? $library->branchname: ''; >+ $branchname = $library ? $library->branchname: ''; > } > if ( $query->param('desk_id') ) { > $desk_id = $query->param('desk_id'); >diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql >index 44cf013bfd..992d9167e3 100644 >--- a/installer/data/mysql/mandatory/userpermissions.sql >+++ b/installer/data/mysql/mandatory/userpermissions.sql >@@ -40,6 +40,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 3, 'manage_smtp_servers', 'Manage SMTP servers configuration'), > ( 3, 'manage_background_jobs', 'Manage background jobs'), > ( 3, 'manage_curbside_pickups', 'Manage curbside pickups'), >+ ( 3, 'select_loggedin_library' , 'Allow user to change logged in library'), > ( 4, 'delete_borrowers', 'Delete patrons'), > ( 4, 'edit_borrowers', 'Add, modify and view patron information'), > ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc >index 61d82953b4..71876ed988 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc >@@ -5,17 +5,13 @@ > > <h5>Circulation</h5> > <ul> >- <li> >- <a href="/cgi-bin/koha/circ/circulation.pl">Check out</a> >- </li> >- <li> >- <a href="/cgi-bin/koha/circ/returns.pl">Check in</a> >- </li> >- <li> >- <a href="/cgi-bin/koha/circ/renew.pl">Renew</a> >- </li> >- [% UNLESS IndependentBranches %] >- <li> >+ <li><a href="/cgi-bin/koha/circ/circulation.pl">Check out</a></li> >+ <li><a href="/cgi-bin/koha/circ/returns.pl">Check in</a></li> >+ <li><a href="/cgi-bin/koha/circ/renew.pl">Renew</a></li> >+ [% IF !Koha.Preference('IndependentBranchesTransfers') || CAN_user_superlibrarian %] >+ <li><a href="/cgi-bin/koha/circ/branchtransfers.pl">Transfer</a></li> >+ [% END %] >+ [% IF ( CAN_user_parameters_select_loggedin_library ) %] > [% IF Koha.Preference('UseCirculationDesks') %] > <a href="/cgi-bin/koha/circ/set-library.pl">Set library and desk</a> > [% ELSE %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >index c04af1d0da..462fa52631 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >@@ -154,7 +154,7 @@ > </li> > [% END %] > >- [% IF !( Koha.Preference('IndependentBranches') && !CAN_user_superlibrarian && !CAN_user_editcatalogue_edit_catalogue ) %] >+ [% IF ( CAN_user_parameters_select_loggedin_library ) %] > <li role="separator" class="loggedin-menu-label divider"></li> > <li> > [% IF Koha.Preference('UseCirculationDesks') && Koha.Preference('UseCashRegisters') %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >index 917f228a4c..06b3d5966a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >@@ -118,6 +118,11 @@ > Manage account debit and credit types > </span> > <span class="permissioncode">([% name | html %])</span> >+ [%- CASE 'select_loggedin_library' -%] >+ <span class="sub_permission manage_accounts_subpermission"> >+ Allow user to change logged in library >+ </span> >+ <span class="permissioncode">([% name | html %])</span> > [%- CASE 'manage_circ_rules' -%] > <span class="sub_permission manage_circ_rules_subpermission"> > Manage circulation rules >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >index ca2d955a57..e8eb32a515 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >@@ -44,7 +44,7 @@ > <li> > <a class="circ-button" href="/cgi-bin/koha/circ/renew.pl"><i class="fa fa-retweet"></i> Renew</a> > </li> >- [% UNLESS IndependentBranches %] >+ [% IF ( CAN_user_parameters_select_loggedin_library ) %] > <li> > [% IF Koha.Preference('UseCirculationDesks') %] > <a class="circ-button" href="/cgi-bin/koha/circ/set-library.pl"><i class="fa fa-home"></i> Set library and desk</a> >@@ -52,6 +52,12 @@ > <a class="circ-button" href="/cgi-bin/koha/circ/set-library.pl"><i class="fa fa-home"></i> Set library</a> > [% END %] > </li> >+ [% ELSE %] >+ <li> >+ [% IF Koha.Preference('UseCirculationDesks') %] >+ <a class="circ-button" href="/cgi-bin/koha/circ/set-library.pl"><i class="fa fa-home"></i> Set desk</a> >+ [% END %] >+ </li> > [% END %] > [% IF ( fast_cataloging ) %] > [% IF ( CAN_user_editcatalogue_fast_cataloging ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt >index f4079542d2..e5eb1a19d5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt >@@ -22,6 +22,19 @@ > [% END %] > > [% WRAPPER 'sub-header.inc' %] >+[% SET page_title = "" %] >+[% IF ( CAN_user_parameters_select_loggedin_library ) %] >+ [% IF Koha.Preference('UseCirculationDesks') %] >+ [% page_title = "Set library and desk" %] >+ [% ELSE %] >+ [% page_title = "Set library" %] >+ [% END %] >+[% ELSE %] >+ [% IF Koha.Preference('UseCirculationDesks') %] >+ [% page_title = "Set desk"%] >+ [% END %] >+[% END %] >+ > <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb"> > <ol> > <li> >@@ -31,7 +44,7 @@ > <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> > </li> > <li> >- <a href="#" aria-current="page">Set library</a> >+ <a href="#" aria-current="page">[% page_title | html %]</a> > </li> > </ol> > </nav> >@@ -42,13 +55,12 @@ > <div class="col-sm-12"> > <main> > <div class="row"> >- > [% IF Koha.Preference('CircSidebar') %] > <div class="col-sm-10 col-sm-push-2"> >- <h1>Set library</h1> >+ <h1>[% page_title | html%]</h1> > [% ELSE %] > <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2"> >- <h1>Set library</h1> >+ <h1>[% page_title | html %]</h1> > [% END %] > > >@@ -84,13 +96,13 @@ Updated:<ul> > [% ELSE %] > > <form method="post" action="set-library.pl"> >-[% IF !( Koha.Preference('IndependentBranches') && !CAN_user_superlibrarian && !CAN_user_editcatalogue_edit_catalogue ) %] >+[% IF ( CAN_user_parameters_select_loggedin_library ) %] > <fieldset class="rows"> > <legend>Set library</legend> > <ol> > <li><label for="branch">Choose library:</label> > <select name="branch" id="branch"> >- [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] >+ [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %] > </select></li> > </ol> > </fieldset> >-- >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 30624
:
136055
|
136076
|
137733
|
138377
|
138378
|
139961
|
139962
|
139963
|
141069
|
141070
|
141071
|
142269
|
142270
|
142271
|
144557
|
144559
|
144584
|
144594
|
144595
|
144596
|
145048
|
145049
|
145631
|
147509
|
147753
|
147754
|
147755
|
147756
|
148116