[Rt-commit] rt branch, 5.0/show-edit-lifecycle-config-option, created. rt-5.0.0-79-g39e9886281

? sunnavy sunnavy at bestpractical.com
Wed Nov 4 16:06:02 EST 2020


The branch, 5.0/show-edit-lifecycle-config-option has been created
        at  39e988628126fa22d7ad2472e1947aab248e5c60 (commit)

- Log -----------------------------------------------------------------
commit 39e988628126fa22d7ad2472e1947aab248e5c60
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Nov 5 04:23:11 2020 +0800

    Add ShowEditLifecycleConfig option to disable lifecycle admin pages

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 2539240f4d..3ad2283f94 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -3652,6 +3652,17 @@ to 0 to disable the web UI editing interface.
 
 Set($ShowEditSystemConfig, 1);
 
+=item C<$ShowEditLifecycleConfig>
+
+Starting in RT 5.0, SuperUsers can edit lifecycle configuration via the web UI.
+Options set in the web UI take precedence over those set in configuration files.
+
+Set C<$ShowEditLifecycleConfig> to 0 to disable the web UI editing interface.
+
+=cut
+
+Set($ShowEditLifecycleConfig, 1);
+
 =back
 
 
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 59ce078f1c..ed19ae5aae 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1601,6 +1601,10 @@ our %META;
         Immutable => 1,
         Widget    => '/Widgets/Form/Boolean',
     },
+    ShowEditLifecycleConfig => {
+        Immutable => 1,
+        Widget    => '/Widgets/Form/Boolean',
+    },
     ShowMoreAboutPrivilegedUsers => {
         Widget => '/Widgets/Form/Boolean',
     },
diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 1d63dc177d..86ff60522d 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -1080,7 +1080,9 @@ sub _BuildAdminMenu {
         $scrips->child( create => title => loc('Create'), path => "/Admin/Scrips/Create.html" );
     }
 
-    if ( $current_user->HasRight( Object => RT->System, Right => 'SuperUser' ) ) {
+    if ( RT->Config->Get('ShowEditLifecycleConfig')
+        && $current_user->HasRight( Object => RT->System, Right => 'SuperUser' ) )
+    {
         my $lifecycles = $admin->child(
             lifecycles => title => loc('Lifecycles'),
             path       => '/Admin/Lifecycles/',
diff --git a/share/html/Admin/Lifecycles/autohandler b/share/html/Admin/Lifecycles/autohandler
index 17efa1553c..ded5cf5795 100644
--- a/share/html/Admin/Lifecycles/autohandler
+++ b/share/html/Admin/Lifecycles/autohandler
@@ -46,10 +46,9 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <%init>
-return $m->call_next(%ARGS) if $session{'CurrentUser'}->UserObj->HasRight(
-    Right => 'SuperUser',
-    Object => $RT::System,
-);
+return $m->call_next(%ARGS)
+    if RT->Config->Get('ShowEditLifecycleConfig')
+    && $session{'CurrentUser'}->UserObj->HasRight( Right => 'SuperUser', Object => $RT::System, );
 
 $m->clear_and_abort(403);
 </%init>

-----------------------------------------------------------------------


More information about the rt-commit mailing list