Bugzilla – Attachment 180602 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 - Non-superuser should not be able to write Additional contents for other branches
Bug-34631-Independentbranches---Non-superuser-shou.patch (text/plain), 6.07 KB, created by
Hammat wele
on 2025-04-03 18:15:58 UTC
(
hide
)
Description:
Bug 34631: Independentbranches - Non-superuser should not be able to write Additional contents for other branches
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2025-04-03 18:15:58 UTC
Size:
6.07 KB
patch
obsolete
>From 3ffaedcdc3df2fab75bd3a6006553dd33640b08a 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 > >Signed-off-by: Myka Kennedy Stephens <mkstephens@fosgail.org> >Signed-off-by: David Nind <david@davidnind.com> >--- > .../prog/en/modules/tools/additional-contents.tt | 6 ++++++ > tools/additional-contents.pl | 10 ++++++++-- > 2 files changed, 14 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 75e1a5215b..dc8c850dbd 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 >@@ -234,6 +234,7 @@ > </select> > [% INCLUDE 'html-customization-help.inc' %] > </li> >+ [% UNLESS my_branch %] > <li> > <label for="branchcode">Library: </label> > <select id="branchcode" name="branchcode"> >@@ -245,6 +246,7 @@ > [% PROCESS options_for_libraries libraries => Branches.all( selected => additional_content.branchcode, unfiltered => 1, ) %] > </select> > </li> >+ [% END %] > [% UNLESS languages.size %] > <li> > [% IF category == 'news' %] >@@ -400,7 +402,9 @@ > [% SET default_localization = c.default_localization %] > <tr [% IF c.is_expired %]class="expired"[% END %]> > <td> >+ [% UNLESS ( my_branch && my_branch != c.branchcode ) %] > <input type="checkbox" name="ids" value="[% c.id | html %]" /> >+ [% END %] > </td> > <td> > [% IF c.category == 'news' || c.category == 'pages' %] >@@ -464,6 +468,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-bs-toggle="dropdown" aria-expanded="false"> </button> >@@ -482,6 +487,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 89dacf9589..ad2d90112c 100755 >--- a/tools/additional-contents.pl >+++ b/tools/additional-contents.pl >@@ -63,6 +63,11 @@ 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 +77,7 @@ if ( $op eq 'add_form' ) { > $category = $additional_content->category; > } > $template->param( >+ my_branch => $my_branch, > additional_content => $additional_content, > translated_contents => $translated_contents, > ); >@@ -79,7 +85,7 @@ if ( $op eq 'add_form' ) { > output_and_exit_if_error( $cgi, $cookie, $template, { check => 'csrf_token' } ); > my $location = $cgi->param('location'); > my $code = $cgi->param('code'); >- my $branchcode = $cgi->param('branchcode') || undef; >+ my $branchcode = $my_branch ? $my_branch : $cgi->param('branchcode') || undef; > > my @lang = $cgi->multi_param('lang'); > >@@ -227,7 +233,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
|
179859
|
179860
| 180602 |
180603
|
180604