From 39e5ecc7ac001e9cad79886af642598a6100787c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 2 Sep 2015 16:30:15 +0100 Subject: [PATCH] Bug 14298: Add warning to the about page if the sco user does not have correct permissions Signed-off-by: Chris Cormack Note: Made a little change, changed He should have, to They should have Signed-off-by: Katrin Fischer (cherry picked from commit f2663af7d1ead6efd7ccc121492a9f264e08b9fc) Signed-off-by: Liz Rea --- about.pl | 28 +++++++++++++++++++ .../intranet-tmpl/prog/en/modules/about.tt | 14 ++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/about.pl b/about.pl index cb32914d10..22d5a96ea3 100755 --- a/about.pl +++ b/about.pl @@ -190,6 +190,34 @@ if ( !defined C4::Context->config('use_zebra_facets') ) { } } +# Sco Patron should not contain any other perms than circulate => self_checkout +if ( C4::Context->preference('WebBasedSelfCheck') + and C4::Context->preference('AutoSelfCheckAllowed') +) { + my $userid = C4::Context->preference('AutoSelfCheckID'); + my $all_permissions = C4::Auth::get_user_subpermissions( $userid ); + my ( $has_self_checkout_perm, $has_other_permissions ); + while ( my ( $module, $permissions ) = each %$all_permissions ) { + if ( $module eq 'circulate' ) { + while ( my ( $permission, $flag ) = each %$permissions ) { + if ( $permission eq 'self_checkout' ) { + $has_self_checkout_perm = 1; + } else { + $has_other_permissions = 1; + } + } + } else { + $has_other_permissions = 1; + } + } + $template->param( + AutoSelfCheckPatronDoesNotHaveSelfCheckPerm => not ( $has_self_checkout_perm ), + AutoSelfCheckPatronHasTooManyPerm => $has_other_permissions, + ); + + +} + $template->param( kohaVersion => $kohaVersion, osVersion => $osVersion, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index ffafe64cdf..cf5ef8d5bb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -101,7 +101,7 @@
[% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || - warnNoActiveCurrency || QueryParserError || warnIsRootUser || xml_config_warnings.size %] + warnNoActiveCurrency || QueryParserError || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm %] [% IF (warnIsRootUser) %]

Warning regarding current user

You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.

@@ -109,7 +109,7 @@ [% END %] [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || - warnNoActiveCurrency || QueryParserError %] + warnNoActiveCurrency || QueryParserError || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm %]

Warnings regarding the system configuration

@@ -137,6 +137,16 @@ [% END %] + [% IF AutoSelfCheckPatronDoesNotHaveSelfCheckPerm %] + + [% END %] + [% IF AutoSelfCheckPatronHasTooManyPerm %] + + [% END %]
Preferences and parameters
Warning + The patron used for the self checkout module at the OPAC does not have the circulate => self_checkout permission. +
Warning + The patron used for the self checkout module at the OPAC has too many permissions. They should only have circulate => self_checkout. +
[% END %] -- 2.39.5