[Rt-commit] rt branch, 5.0-trunk, updated. rt-5.0.0beta1-13-g47a9f37626

? sunnavy sunnavy at bestpractical.com
Wed Jun 10 14:07:48 EDT 2020


The branch, 5.0-trunk has been updated
       via  47a9f376260f31477a1fde6d48eede9c592a11b8 (commit)
       via  59f48f2f484a314af4d5965e8cb868f79c6facd9 (commit)
       via  ecce5539b9e4c0c5852aeaeb6a92f39400899f42 (commit)
       via  4a415ef1caab44b242a9e6561541a566bc24c67a (commit)
      from  65b2088df181e9562d73d2cfaa2ee4ba2a2bb056 (commit)

Summary of changes:
 docs/UPGRADING-5.0                     | 11 +++++++++++
 etc/RT_Config.pm.in                    | 12 ++++++++++++
 lib/RT/Config.pm                       |  4 ++++
 lib/RT/Interface/Web/MenuBuilder.pm    |  2 +-
 share/html/Admin/Tools/EditConfig.html |  2 ++
 t/web/admin_tools_editconfig.t         | 13 ++++++++++++-
 6 files changed, 42 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 4a415ef1caab44b242a9e6561541a566bc24c67a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Apr 16 03:59:45 2020 +0800

    Add ShowEditSystemConfig option to disable EditConfig page

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index f2ec3c14f2..51fe3c13e3 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -3614,6 +3614,18 @@ Set(%AdminSearchResultRows,
     Assets       => 50,
 );
 
+=item C<$ShowEditSystemConfig>
+
+Starting in RT 5.0, SuperUsers can edit RT system configuration via the web UI.
+Options set in the web UI take precedence over those set in configuration files.
+
+If you prefer to set configuration only via files, set C<$ShowEditSystemConfig>
+to 0 to disable the web UI editing interface.
+
+=cut
+
+Set($ShowEditSystemConfig, 1);
+
 =back
 
 
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 663c88dcbf..400dd5ac22 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1594,6 +1594,10 @@ our %META;
     ShowBccHeader => {
         Widget => '/Widgets/Form/Boolean',
     },
+    ShowEditSystemConfig => {
+        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 972490e003..17eac59cb7 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -927,7 +927,7 @@ sub BuildMainNav {
 
     if ( $request_path =~ m{^/Admin/Tools/(Configuration|EditConfig|ConfigHistory)} ) {
         $page->child( display => title => loc('View'), path => "/Admin/Tools/Configuration.html" );
-        $page->child( modify => title => loc('Edit'), path => "/Admin/Tools/EditConfig.html" );
+        $page->child( modify => title => loc('Edit'), path => "/Admin/Tools/EditConfig.html" ) if RT->Config->Get('ShowEditSystemConfig');
         $page->child( history => title => loc('History'), path => "/Admin/Tools/ConfigHistory.html" );
     }
 
diff --git a/share/html/Admin/Tools/EditConfig.html b/share/html/Admin/Tools/EditConfig.html
index 85bbc4927f..2a33c93348 100644
--- a/share/html/Admin/Tools/EditConfig.html
+++ b/share/html/Admin/Tools/EditConfig.html
@@ -46,6 +46,8 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <%INIT>
+Abort( loc( 'Permission Denied' ) ) unless RT->Config->Get('ShowEditSystemConfig');
+
 my $title = loc('System Configuration');
 unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser')) {
  Abort(loc('This feature is only available to system administrators'));

commit ecce5539b9e4c0c5852aeaeb6a92f39400899f42
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Apr 16 04:08:59 2020 +0800

    Test ShowEditSystemConfig option

diff --git a/t/web/admin_tools_editconfig.t b/t/web/admin_tools_editconfig.t
index 826c8adf58..f23d2fdb04 100644
--- a/t/web/admin_tools_editconfig.t
+++ b/t/web/admin_tools_editconfig.t
@@ -4,11 +4,22 @@ use warnings;
 use Test::Deep;
 use Data::Dumper ();
 
-use RT::Test tests => undef;
+use RT::Test tests => undef, config => 'Set($ShowEditSystemConfig, 0);';
 
 my ( $url, $m ) = RT::Test->started_ok;
 ok( $m->login(), 'logged in' );
 
+$m->follow_link_ok( { text => 'System Configuration' }, 'followed link to "System Configuration"' );
+ok( !$m->find_link( text => 'Edit' ), 'no edit link' );
+$m->get_ok('/Admin/Tools/EditConfig.html');
+$m->content_contains('Permission Denied');
+
+RT::Test->stop_server;
+RT->Config->Set( ShowEditSystemConfig => 1 );
+
+( $url, $m ) = RT::Test->started_ok;
+ok( $m->login(), 'logged in' );
+
 $m->follow_link_ok( { text => 'System Configuration' }, 'followed link to "System Configuration"' );
 $m->follow_link_ok( { text => 'History' }, 'followed link to History page' );
 $m->follow_link_ok( { text => 'Edit' }, 'followed link to Edit page' );

commit 59f48f2f484a314af4d5965e8cb868f79c6facd9
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Tue Apr 28 11:06:46 2020 -0400

    Note web UI configuration in upgrading doc

diff --git a/docs/UPGRADING-5.0 b/docs/UPGRADING-5.0
index 0e58d4cb4b..e82a5670d0 100644
--- a/docs/UPGRADING-5.0
+++ b/docs/UPGRADING-5.0
@@ -66,6 +66,17 @@ space, it can cause this step to fail.
 
 =item *
 
+System configuration options can now be changed by SuperUsers via the
+web UI. File-based configuration options are still loaded. Changes made
+via the web UI take precedence over file-based options if both are set.
+
+If you prefer to keep all configuration in files and disable editing in
+the web UI, set this option to 0:
+
+    Set($ShowEditSystemConfig, 0);
+
+=item *
+
 The variables which alter the set of HTML elements allowed in HTML
 scrubbing have moved; they have been renamed, and are now found under
 L<RT::Interface::Web::Scrubber>.

commit 47a9f376260f31477a1fde6d48eede9c592a11b8
Merge: 65b2088df1 59f48f2f48
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Jun 11 02:07:14 2020 +0800

    Merge branch '5.0/show-edit-system-config-option' into 5.0-trunk


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


More information about the rt-commit mailing list