Bug 15326: (follow-up) Fix staff permissions and consider library limits
To test: 1. Take note of what your logged in library is 2. Add a new page that can be viewed on the OPAC and staff interface. Limit the library to a different library, not your logged in library 3. Use a News item to create a hyperlink to your new page on the OPAC and staff interface. 4. Confirm that a page error shows if you try to view the new page. 5. Edit the new page and set the library to All libraries. 6. Try to go to the new page again and confirm it shows. 7. Log out and log back into the staff interface as a staff user that isn't a superlibrarian 8. Confirm you can view the new page as this user Sponsored-by: Horowhenua Libraries Trust Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
e55864db27
commit
01091c8089
2 changed files with 9 additions and 3 deletions
|
@ -36,8 +36,13 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
|||
my $page_id = $query->param('page_id');
|
||||
my $page;
|
||||
|
||||
my $homebranch = $ENV{OPAC_BRANCH_DEFAULT};
|
||||
if (C4::Context->userenv) {
|
||||
$homebranch = C4::Context->userenv->{'branch'};
|
||||
}
|
||||
|
||||
if (defined $page_id){
|
||||
$page = Koha::AdditionalContents->search({ idnew => $page_id, location => ['opac_only', 'staff_and_opac'] });
|
||||
$page = Koha::AdditionalContents->search({ idnew => $page_id, location => ['opac_only', 'staff_and_opac'], branchcode => [ $homebranch, undef ] });
|
||||
if ( $page->count > 0){
|
||||
$template->param( page => $page->next );
|
||||
} else {
|
||||
|
|
|
@ -28,7 +28,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|||
template_name => "tools/page.tt",
|
||||
query => $query,
|
||||
type => "intranet",
|
||||
flagsrequired => { tools => '*' },
|
||||
flagsrequired => { catalogue => 1 },
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -36,7 +36,8 @@ my $page_id = $query->param('page_id');
|
|||
my $page;
|
||||
|
||||
if (defined $page_id){
|
||||
$page = Koha::AdditionalContents->search({ idnew => $page_id, location => ['staff_only', 'staff_and_opac'] });
|
||||
my $branch = C4::Context->userenv->{'branch'};
|
||||
$page = Koha::AdditionalContents->search({ idnew => $page_id, location => ['staff_only', 'staff_and_opac'], branchcode => [ $branch, undef ] });
|
||||
if ( $page->count > 0){
|
||||
$template->param( page => $page->next );
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue