Bugzilla – Attachment 162787 Details for
Bug 34631
Independentbranches - Non-superuser should not be able to write Additional contents for other branches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34631: Independentbranches - rebase to master
Bug-34631-Independentbranches---Non-superuser-shou.patch (text/plain), 6.16 KB, created by
Matthias Le Gac
on 2024-03-05 17:20:41 UTC
(
hide
)
Description:
Bug 34631: Independentbranches - rebase to master
Filename:
MIME Type:
Creator:
Matthias Le Gac
Created:
2024-03-05 17:20:41 UTC
Size:
6.16 KB
patch
obsolete
>From f87ffef2a88baa720716a66dd837414e821cae75 Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Mon, 28 Aug 2023 17:21:44 +0000 >Subject: [PATCH] Bug 34631: Independentbranches - Non-superuser should not be > able to write Additional contents for other branches > >When syspref Independentbranches is enabled Non-superuser should not be able to write Additional contents for other branches > >To reproduce: >1- Connect to staff interface as superlibrarian >2- Enable IndependentBranches preference >3- Go to Tools -> HTML customizations >4- Crete an additional content for all libraries >5- Create or edit a borrower > 5-1- Set permission for the borrower > - catalogue > - edit_additional_contents >4- Log in to the staff interface with the non-superlibrarian staff user >5- Go to Tools -> HTML customizations > --> you can delete or edit the additional contents created by superlibrarian for All libraries >6- Click on New entry > --> you can add additional content for other branches >7- Apply the patch >8- Repeat step 5 > --> you cannot delete or edit the additional contents create by superlibrarian for All libraries >9- Repeat step 6 > --> you cannot add additional content for other branches >10- submit the form > --> the branch of the created additional content is the current user branch >--- > .../prog/en/modules/tools/additional-contents.tt | 8 +++++++- > tools/additional-contents.pl | 11 ++++++++++- > 2 files changed, 17 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >index 2a7ff46f7b..a8e8990529 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >@@ -239,6 +239,7 @@ > </select> > [% INCLUDE 'html-customization-help.inc' %] > </li> >+ [% UNLESS my_branch %] > <li> > <label for="branchcode">Library: </label> > <select id="branchcode" name="branchcode"> >@@ -250,6 +251,7 @@ > [% PROCESS options_for_libraries libraries => Branches.all( selected => additional_content.branchcode, unfiltered => 1, ) %] > </select> > </li> >+ [% END %] > [% UNLESS languages.size %] > <li> > [% IF category == 'news' %] >@@ -404,7 +406,9 @@ > [% SET default_localization = c.default_localization %] > [% IF ( c.is_expired ) %]<tr class="expired">[% ELSE %]<tr>[% END %] > <td> >- <input type="checkbox" name="ids" value="[% c.id | html %]" /> >+ [% UNLESS ( my_branch && my_branch != c.branchcode ) %] >+ <input type="checkbox" name="ids" value="[% c.idnew | html %]" /> >+ [% END %] > </td> > <td> > [% IF c.category == 'news' || c.category == 'pages' %] >@@ -460,6 +464,7 @@ > </div> > </td> > <td class="actions"> >+ [% UNLESS ( my_branch && my_branch != c.branchcode ) %] > <div class="btn-group dropup"> > <a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&id=[% c.id | uri %]&editmode=[% editmode | uri %]" class="btn btn-default btn-xs"> <i class="fa-solid fa-pencil"></i> Edit</a><button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown"> > <span class="caret"></span> >@@ -477,6 +482,7 @@ > <div class="btn-group"> > <a href="#" class="delete_news btn btn-default btn-xs" data-id="[% c.id | html %]"><i class="fa fa-trash-can"></i> Delete</a> > </div> >+ [% END %] > </td> > </tr> > [% END %] >diff --git a/tools/additional-contents.pl b/tools/additional-contents.pl >index 8cfdd34ab5..cba94ef2c4 100755 >--- a/tools/additional-contents.pl >+++ b/tools/additional-contents.pl >@@ -63,6 +63,9 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > ); > > my @messages; >+my $my_branch = C4::Context->preference("IndependentBranches") && !C4::Context->IsSuperLibrarian() >+ ? C4::Context->userenv()->{'branch'} >+ : undef; > if ( $op eq 'add_form' ) { > > my $additional_content = Koha::AdditionalContents->find($id); >@@ -72,6 +75,7 @@ if ( $op eq 'add_form' ) { > $category = $additional_content->category; > } > $template->param( >+ my_branch => $my_branch, > additional_content => $additional_content, > translated_contents => $translated_contents, > ); >@@ -80,7 +84,12 @@ elsif ( $op eq 'cud-add_validate' ) { > output_and_exit_if_error( $cgi, $cookie, $template, { check => 'csrf_token' } ); > my $location = $cgi->param('location'); > my $code = $cgi->param('code'); >+<<<<<<< HEAD > my $branchcode = $cgi->param('branchcode') || undef; >+======= >+ my $branchcode = $my_branch ? $my_branch : $cgi->param('branchcode') || undef; >+ my $idnew = $cgi->param('idnew'); >+>>>>>>> Bug 34631: Independentbranches - Non-superuser should not be able to write Additional contents for other branches > > my @lang = $cgi->multi_param('lang'); > >@@ -223,7 +232,7 @@ if ( $op eq 'list' ) { > { category => $category, 'additional_contents_localizations.lang' => 'default' }, > { order_by => { -desc => 'published_on' }, join => 'additional_contents_localizations' } > ); >- $template->param( additional_contents => $additional_contents ); >+ $template->param( additional_contents => $additional_contents, my_branch => $my_branch ); > } > > my $translated_languages = C4::Languages::getTranslatedLanguages; >-- >2.34.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 34631
:
154889
|
154890
|
162787
|
162788
|
162856
|
162929
|
162972
|
162995
|
172231
|
175973
|
175974
|
175975
|
175976