[Rt-commit] rt branch, 4.6/configindatabase-themed, updated. rt-4.4.4-609-gf61eda75a5

? sunnavy sunnavy at bestpractical.com
Fri Dec 20 11:16:44 EST 2019


The branch, 4.6/configindatabase-themed has been updated
       via  f61eda75a5151800d4b3d9254b3b9c5d4555ee4b (commit)
       via  d31121acb4fd45282331dcdcfc5d638db6030d6f (commit)
       via  eec877ce2ffa08cabd7bc6424ac82a2f55de1085 (commit)
       via  533c87ad3434d06ea8b582c235110e84fee952f0 (commit)
       via  8f97f1b348f06d04ded0b21914295dd047ec9255 (commit)
       via  a28cc31084e7fc6678e9f76c98efecc346f5e70d (commit)
      from  147dd3a1f20ddb23ef6e99afb40688eb13a976c6 (commit)

Summary of changes:
 lib/RT/Config.pm                                  | 28 ++++++++++++++++++++---
 share/html/Admin/Tools/Config/Elements/Option     |  3 ++-
 share/html/Admin/Tools/Config/Elements/SubSection |  5 ++++
 share/html/Admin/Tools/Configuration.html         |  2 +-
 share/html/Admin/Tools/EditConfig.html            |  4 +++-
 5 files changed, 36 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit a28cc31084e7fc6678e9f76c98efecc346f5e70d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Dec 20 21:32:58 2019 +0800

    Hide all crypt related configs from web
    
    There are passwords in some configs, which we shouldn't show on web.
    Besides, some configs are also related to filesystem settings, so it's
    probably more straightforward that admins update them via site config,
    considering they will log in to server anyway.

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 42fe9af563..d6c7f2da2d 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -820,6 +820,8 @@ our %META;
         },
     },
     Crypt        => {
+        Immutable => 1,
+        Invisible => 1,
         Type => 'HASH',
         PostLoadCheck => sub {
             my $self = shift;
@@ -866,6 +868,8 @@ our %META;
     },
     SMIME        => {
         Type => 'HASH',
+        Immutable => 1,
+        Invisible => 1,
         PostLoadCheck => sub {
             my $self = shift;
             my $opt = $self->Get('SMIME');
@@ -900,6 +904,8 @@ our %META;
     },
     GnuPG        => {
         Type => 'HASH',
+        Immutable => 1,
+        Invisible => 1,
         PostLoadCheck => sub {
             my $self = shift;
             my $gpg = $self->Get('GnuPG');
@@ -928,7 +934,11 @@ our %META;
             }
         }
     },
-    GnuPGOptions => { Type => 'HASH' },
+    GnuPGOptions => {
+        Type      => 'HASH',
+        Immutable => 1,
+        Invisible => 1,
+    },
     ReferrerWhitelist => { Type => 'ARRAY' },
     EmailDashboardLanguageOrder  => { Type => 'ARRAY' },
     CustomFieldValuesCanonicalizers => { Type => 'ARRAY' },
@@ -1971,7 +1981,10 @@ sub LoadSectionMap {
                 while ( $content =~ m{<code>(.)([^<]*)</code>}sg ) {
                     my ( $sigil, $option ) = ( $1, $2 );
                     next unless $sigil =~ m{[\@\%\$]};    # no sigil => this is a value for a select option
-                    if ( !$META{$option} ) {
+                    if ( $META{$option} ) {
+                        next if $META{$option}{Invisible};
+                    }
+                    else {
                         RT->Logger->debug("No META info for option [$option], falling back to Code widget");
                     }
                     push @{ $SectionMap->[-1]{Content}[-1]{Content}[-1]{Content} }, { Name => $option, Help => $name };

commit 8f97f1b348f06d04ded0b21914295dd047ec9255
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Dec 20 21:59:25 2019 +0800

    Suppress stack info trace from user interface

diff --git a/share/html/Admin/Tools/EditConfig.html b/share/html/Admin/Tools/EditConfig.html
index 84bd883369..029fc0f918 100644
--- a/share/html/Admin/Tools/EditConfig.html
+++ b/share/html/Admin/Tools/EditConfig.html
@@ -168,6 +168,8 @@ if (delete $ARGS{Update}) {
         $has_error++;
     }
 
+    @results = map { s/^Stack:.*//ms; $_ } @results;
+
     if ($has_error) {
         push @results, loc("No changes made.");
         $RT::Handle->Rollback;

commit 533c87ad3434d06ea8b582c235110e84fee952f0
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Dec 20 22:36:23 2019 +0800

    Clean up obsolete config AllowLoginPasswordAutoComplete

diff --git a/share/html/Admin/Tools/Config/Elements/Option b/share/html/Admin/Tools/Config/Elements/Option
index e68e6e7621..b32d68b17e 100644
--- a/share/html/Admin/Tools/Config/Elements/Option
+++ b/share/html/Admin/Tools/Config/Elements/Option
@@ -67,7 +67,7 @@ $doc_version =~ s/\.\d+-\d+-g\w+$//;  # 4.4.3-1-g123 -> 4.4
 my $name = $option->{Name};
 my $meta = RT->Config->Meta( $name );
 return if $meta->{Invisible} || $meta->{Deprecated};
-return if $name =~ /Password/i && $name !~ /MinimumPasswordLength|AllowLoginPasswordAutoComplete/;
+return if $name =~ /Password/i && $name !~ /MinimumPasswordLength/;
 
 my $has_execute_code = $session{CurrentUser}->HasRight(Right => 'ExecuteCode', Object => RT->System);
 
diff --git a/share/html/Admin/Tools/Configuration.html b/share/html/Admin/Tools/Configuration.html
index 66df5bdf0e..1cc1ed7899 100644
--- a/share/html/Admin/Tools/Configuration.html
+++ b/share/html/Admin/Tools/Configuration.html
@@ -91,7 +91,7 @@ foreach my $key ( RT->Config->Options( Overridable => undef, Sorted => 0 ) ) {
   <div class="form-row <% $index_conf%2 ? 'oddline' : 'evenline'%>">
     <div class="col-md-4 collection-as-table value"><% $key %></div>
     <div class="col-md-4 collection-as-table value">
-% if ( $key =~ /Password/i and $key !~ /MinimumPasswordLength|AllowLoginPasswordAutoComplete/ ) {
+% if ( $key =~ /Password/i and $key !~ /MinimumPasswordLength/ ) {
 <em><% loc('Password not printed' ) %></em>\
 % } else {
 <% stringify($val) |n %>\
diff --git a/share/html/Admin/Tools/EditConfig.html b/share/html/Admin/Tools/EditConfig.html
index 029fc0f918..603c46ce8c 100644
--- a/share/html/Admin/Tools/EditConfig.html
+++ b/share/html/Admin/Tools/EditConfig.html
@@ -99,7 +99,7 @@ if (delete $ARGS{Update}) {
                 next if !!$val eq !!$prev;
             }
 
-            if ( $meta->{Immutable} || $meta->{Obfuscate} || ($key =~ /Password/i and $key !~ /MinimumPasswordLength|AllowLoginPasswordAutoComplete/ )) {
+            if ( $meta->{Immutable} || $meta->{Obfuscate} || ($key =~ /Password/i and $key !~ /MinimumPasswordLength/ )) {
                 push @results, loc("Cannot change [_1]: Permission Denied", $key);
                 $has_error++;
                 next;

commit eec877ce2ffa08cabd7bc6424ac82a2f55de1085
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Dec 20 22:39:28 2019 +0800

    Don't show "Save Changes" if there is nothing to change

diff --git a/share/html/Admin/Tools/Config/Elements/SubSection b/share/html/Admin/Tools/Config/Elements/SubSection
index 5e407ea9c5..01cb947e1b 100644
--- a/share/html/Admin/Tools/Config/Elements/SubSection
+++ b/share/html/Admin/Tools/Config/Elements/SubSection
@@ -56,17 +56,22 @@
 %     map { $current_context->{$_} }
 %     (qw( tab section subsection ) );
 <&|/Widgets/TitleBox, title => $complete_title &>
+% my $can_edit;
 % foreach my $option ( @{$subsection->{Content}} ) {
+%   $can_edit ||= 1 unless $RT::Config::META{$option->{Name}}{Immutable};
   <& /Admin/Tools/Config/Elements/Option, option => $option &>
 % }
 <input type="hidden" name="tab" value="<% $current_context->{tab} %>" />
 <input type="hidden" name="section" value="<% $current_context->{section} %>" />
 <input type="hidden" name="subsection" value="<% $current_context->{subsection} %>" />
+
+% if ( $can_edit ) {
 <div class="form-row">
   <span class="col-md-12">
     <& /Elements/Submit, Label => loc('Save Changes') &>
   </span>
 </div>
+% }
 </&>
 </form>
 % }

commit d31121acb4fd45282331dcdcfc5d638db6030d6f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Dec 20 23:23:41 2019 +0800

    Make log configs immutable as updates from web doesn't work
    
    Logging is initialized quite early in RT, especially in various scripts,
    so log configs set in database are skipped in quite a few cases.
    
    There are more changes involved to make it fully work, which deserves
    another branch. For now, just make log configs readonly on web.

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index d6c7f2da2d..8e84203588 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1627,9 +1627,11 @@ our %META;
         Widget => '/Widgets/Form/String',
     },
     LogDir => {
+        Immutable => 1,
         Widget => '/Widgets/Form/String',
     },
     LogToFileNamed => {
+        Immutable => 1,
         Widget => '/Widgets/Form/String',
     },
     LogoAltText => {
@@ -1680,18 +1682,22 @@ our %META;
     },
 
     LogToSyslog => {
+        Immutable => 1,
         Widget => '/Widgets/Form/Select',
         WidgetArguments => { Values => [qw(debug info notice warning error critical alert emergency)] },
     },
     LogToSTDERR => {
+        Immutable => 1,
         Widget => '/Widgets/Form/Select',
         WidgetArguments => { Values => [qw(debug info notice warning error critical alert emergency)] },
     },
     LogToFile => {
+        Immutable => 1,
         Widget => '/Widgets/Form/Select',
         WidgetArguments => { Values => [qw(debug info notice warning error critical alert emergency)] },
     },
     LogStackTraces => {
+        Immutable => 1,
         Widget => '/Widgets/Form/Select',
         WidgetArguments => { Values => [qw(debug info notice warning error critical alert emergency)] },
     },
@@ -1721,6 +1727,9 @@ our %META;
         Widget => '/Widgets/Form/Select',
         WidgetArguments => { Values => [qw(ASC DESC)] },
     },
+    LogToSyslogConf => {
+        Immutable     => 1,
+    },
 );
 my %OPTIONS = ();
 my @LOADED_CONFIGS = ();

commit f61eda75a5151800d4b3d9254b3b9c5d4555ee4b
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Dec 20 23:42:11 2019 +0800

    Add empty option to StatementLog so we can disable it

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 8e84203588..f26b9c8ad8 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1703,7 +1703,7 @@ our %META;
     },
     StatementLog => {
         Widget => '/Widgets/Form/Select',
-        WidgetArguments => { Values => [qw(debug info notice warning error critical alert emergency)] },
+        WidgetArguments => { Values => ['', qw(debug info notice warning error critical alert emergency)] },
     },
 
     DefaultCatalog => {
diff --git a/share/html/Admin/Tools/Config/Elements/Option b/share/html/Admin/Tools/Config/Elements/Option
index b32d68b17e..41617d0b44 100644
--- a/share/html/Admin/Tools/Config/Elements/Option
+++ b/share/html/Admin/Tools/Config/Elements/Option
@@ -99,6 +99,7 @@ elsif ($widget eq '/Widgets/Form/String' || $widget eq '/Widgets/Form/Integer')
 elsif ($widget eq '/Widgets/Form/Select') {
     %$args = (
         $args->{Default} ? ( DefaultLabel => loc('(no value)') ) : (),
+        ValuesLabel => { '' => '(no value)' },
         %$args,
     );
 }

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


More information about the rt-commit mailing list