Bugzilla – Attachment 101939 Details for
Bug 15522
New interface for revamped circulation rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15522: Fix permission name manage_circ_rules_from_any_libraries
Bug-15522-Fix-permission-name-managecircrulesfroma.patch (text/plain), 2.91 KB, created by
Lari Taskula
on 2020-03-27 03:11:00 UTC
(
hide
)
Description:
Bug 15522: Fix permission name manage_circ_rules_from_any_libraries
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2020-03-27 03:11:00 UTC
Size:
2.91 KB
patch
obsolete
>From defcb2bcb2f05c24dadecfa461a9399f43b0607e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sun, 4 Aug 2019 21:28:24 -0500 >Subject: [PATCH] Bug 15522: Fix permission name > manage_circ_rules_from_any_libraries > >On 15520 followups have been provided to not use a negative permission. > >Note that two api tests are failing (get 400). I would like some help to >investigate here why 400 is returned instead of 403. > >Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org> >--- > Koha/REST/V1/CirculationRules.pm | 2 +- > admin/policy.pl | 2 +- > t/db_dependent/api/v1/circ_rules.t | 4 ++-- > 3 files changed, 4 insertions(+), 4 deletions(-) > >diff --git a/Koha/REST/V1/CirculationRules.pm b/Koha/REST/V1/CirculationRules.pm >index 2e56180fd3..2f30b12f65 100644 >--- a/Koha/REST/V1/CirculationRules.pm >+++ b/Koha/REST/V1/CirculationRules.pm >@@ -62,7 +62,7 @@ sub save_rules { > my $schema = Koha::Database->new->schema; > > my $uid = $c->stash( 'koha.user' )->userid; >- my $restricted_to_library = $uid && haspermission( $uid, { parameters => 'manage_circ_rules_restricted' }, { no_inherit => 1 } ) ? $c->stash( 'koha.user' )->branchcode : ""; >+ my $restricted_to_library = $uid && haspermission( $uid, { parameters => 'manage_circ_rules_from_any_libraries' } ) ? "" : $c->stash( 'koha.user' )->branchcode; > > return try { > my $rules = $c->req->json; >diff --git a/admin/policy.pl b/admin/policy.pl >index c6c771460b..f10a12296d 100755 >--- a/admin/policy.pl >+++ b/admin/policy.pl >@@ -41,7 +41,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > ); > > my $uid = Koha::Patrons->find( $borrowernumber )->userid; >-my $restricted_to_own_library = $uid && haspermission( $uid, { parameters => 'manage_circ_rules_restricted' }, { no_inherit => 1 } ); >+my $restricted_to_own_library = !( $uid && haspermission( $uid, { parameters => 'manage_circ_rules_from_any_libraries' } ) ); > $template->param( restricted_to_library => $restricted_to_own_library ? C4::Context::mybranch() : "" ); > > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/t/db_dependent/api/v1/circ_rules.t b/t/db_dependent/api/v1/circ_rules.t >index 688395644e..47b5317f44 100644 >--- a/t/db_dependent/api/v1/circ_rules.t >+++ b/t/db_dependent/api/v1/circ_rules.t >@@ -253,11 +253,11 @@ sub create_user_and_session { > $session->param( 'lasttime', time() ); > $session->flush; > >- if ( $args->{permissions} eq 'authorized_restricted' ) { >+ if ( $args->{permissions} ne 'authorized_restricted' ) { > $dbh->do( > q{ > INSERT INTO user_permissions (borrowernumber,module_bit,code) >- VALUES (?,3,'manage_circ_rules_restricted'), (?,3,'manage_circ_rules')}, >+ VALUES (?,3,'manage_circ_rules_from_any_libraries'), (?,3,'manage_circ_rules')}, > undef, $user->{borrowernumber}, $user->{borrowernumber} > ); > } >-- >2.17.1
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 15522
:
68231
|
68232
|
68233
|
68234
|
68235
|
71048
|
71049
|
71050
|
71051
|
71052
|
72239
|
72242
|
91977
|
91978
|
91979
|
91980
|
91981
|
91982
|
91983
|
91984
|
94201
|
94202
|
94203
|
94204
|
94205
|
94206
|
94207
|
94208
|
99148
|
99149
|
99150
|
99151
|
99152
|
99153
|
99154
|
99155
|
99156
|
99157
|
99199
|
99200
|
99201
|
99202
|
99203
|
99204
|
99205
|
99206
|
99207
|
99208
|
99209
|
99210
|
99211
|
99213
|
99214
|
99215
|
101918
|
101919
|
101920
|
101921
|
101922
|
101923
|
101924
|
101925
|
101926
|
101927
|
101934
|
101935
|
101936
|
101937
|
101938
|
101939
|
101940
|
101941
|
101942
|
101943
|
101944
|
101945
|
101946
|
101947
|
106913
|
106914
|
106915
|
106916
|
106917
|
106918
|
106919
|
106920
|
106921
|
106922
|
106923
|
106924
|
106925
|
106926
|
112056
|
112057
|
112058
|
112059
|
112060
|
112061