From e7b004689c901af68d65bda6b36054b4242ef6e9 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 13 Mar 2018 10:15:31 +0000 Subject: [PATCH] Bug 20383: Hide link to plugin management if plugins are not enabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch adds a check in admin-home.pl to see whether plugins are enabled. If plugins are disabled, the link to plugins management is hidden even if the user has plugin management permission. To test, view the administration home page with plugins enabled and disabled via the enable_plugins flag in the Koha configuration file. Also test using users with different plugins permissions: - Plugins enabled - CAN_user_plugins = 1 -> Plugins link appears - CAN_user_plugins = 0 -> Plugins link hidden - Plugins disabled - CAN_user_plugins = 1, - CAN_user_plugins = 0 -> Plugins link hidden Signed-off-by: Séverine QUEUNE Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- admin/admin-home.pl | 6 ++++++ koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/admin/admin-home.pl b/admin/admin-home.pl index 7c1d0581be..ae16bf6680 100755 --- a/admin/admin-home.pl +++ b/admin/admin-home.pl @@ -20,8 +20,12 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Auth; use C4::Output; +use Koha::Plugins; my $query = new CGI; + +my $plugins_enabled = C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins"); + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "admin/admin-home.tt", @@ -33,4 +37,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); +$template->param( plugins_enabled => $plugins_enabled, ); + output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index c1233b0cf8..af9a53b43d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -59,7 +59,7 @@
Cities and towns
Define cities and towns that your patrons live in.
- [% IF CAN_user_plugins %] + [% IF CAN_user_plugins && plugins_enabled %]

Plugins

Manage plugins
-- 2.39.5