[Bps-public-commit] rt-extension-formtools branch dynamic-forms-from-config updated. 0.53-64-gadda559

BPS Git Server git at git.bestpractical.com
Fri Oct 27 09:10:09 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-formtools".

The branch, dynamic-forms-from-config has been updated
       via  adda559a8036236d8743c1c86b1d5a84ab144219 (commit)
      from  00680b2e017c07f7727b1c03f2d00ea8f1b60db5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit adda559a8036236d8743c1c86b1d5a84ab144219
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Oct 27 02:18:50 2023 -0400

    Add AdminForm so non-superusers can admin forms too

diff --git a/html/Admin/FormTools/Advanced.html b/html/Admin/FormTools/Advanced.html
index 7605e5f..a6e520f 100644
--- a/html/Admin/FormTools/Advanced.html
+++ b/html/Admin/FormTools/Advanced.html
@@ -37,7 +37,7 @@ $title = loc("Modify form [_1]", $form_attribute->Description);
 
 if ( $Update ) {
     Abort( loc('Permission Denied') )
-        unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'SuperUser' );
+        unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminForm' );
 
     if ( $ARGS{Description} ) {
 
diff --git a/html/Admin/FormTools/Create.html b/html/Admin/FormTools/Create.html
index 9c27b61..0ab9ed1 100644
--- a/html/Admin/FormTools/Create.html
+++ b/html/Admin/FormTools/Create.html
@@ -20,7 +20,7 @@
 </&>
 <%INIT>
 Abort( loc('Permission Denied') )
-    unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'SuperUser' );
+    unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminForm' );
 
 my ($title, @results);
 $title = loc('Create form');
diff --git a/html/Admin/FormTools/Describe.html b/html/Admin/FormTools/Describe.html
index a4a1635..b921c54 100644
--- a/html/Admin/FormTools/Describe.html
+++ b/html/Admin/FormTools/Describe.html
@@ -60,7 +60,7 @@ $title = loc("Description for form [_1]", $form_attribute->Description);
 
 if ( $ARGS{'SubmitDescription'} ) {
     Abort( loc('Permission Denied') )
-        unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'SuperUser' );
+        unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminForm' );
 
     if ( $form->{'form-description'} ne $ARGS{'FormDescription'} ) {
         $form->{'form-description'} = $ARGS{'FormDescription'};
diff --git a/html/Admin/FormTools/Modify.html b/html/Admin/FormTools/Modify.html
index 9d8d284..2b98c37 100644
--- a/html/Admin/FormTools/Modify.html
+++ b/html/Admin/FormTools/Modify.html
@@ -418,7 +418,7 @@ my @results;
 
 if ( $AddPage ) {
     Abort( loc('Permission Denied') )
-        unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'SuperUser' );
+        unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminForm' );
 
     my @orders = sort { $a <=> $b } map { $form->{'formtools-pages'}{$_}{sort_order} } keys %{$form->{'formtools-pages'}};
 
@@ -443,7 +443,7 @@ if ( $AddPage ) {
 }
 elsif ( $Update ) {
     Abort( loc('Permission Denied') )
-        unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'SuperUser' );
+        unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminForm' );
 
     my $new_content = eval { JSON::from_json( $ARGS{Content} ) };
     if ( $@ ) {
diff --git a/html/Callbacks/FormTools/Elements/Tabs/Privileged b/html/Callbacks/FormTools/Elements/Tabs/Privileged
index 7c48c7b..8074fd6 100644
--- a/html/Callbacks/FormTools/Elements/Tabs/Privileged
+++ b/html/Callbacks/FormTools/Elements/Tabs/Privileged
@@ -1,6 +1,8 @@
 <%init>
 
-if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'SuperUser' ) ) {
+if ( Menu->child('admin')
+    && $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminForm' ) )
+{
     my $formtools = Menu->child('admin')->child(
         formtools => title => loc('FormTools'),
         path      => '/Admin/FormTools/',
diff --git a/lib/RT/Extension/FormTools.pm b/lib/RT/Extension/FormTools.pm
index 7a85f9a..238ed56 100644
--- a/lib/RT/Extension/FormTools.pm
+++ b/lib/RT/Extension/FormTools.pm
@@ -8,6 +8,8 @@ our $VERSION = '0.53';
 RT->AddStyleSheets('rt-extension-formtools.css');
 RT->AddJavaScript('rt-extension-formtools.js');
 
+RT::System->AddRight( Admin => AdminForm => 'Create, modify and disable forms' ); # loc
+
 use Time::HiRes 'time';
 use Digest::SHA 'sha1_hex';
 

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

Summary of changes:
 html/Admin/FormTools/Advanced.html                | 2 +-
 html/Admin/FormTools/Create.html                  | 2 +-
 html/Admin/FormTools/Describe.html                | 2 +-
 html/Admin/FormTools/Modify.html                  | 4 ++--
 html/Callbacks/FormTools/Elements/Tabs/Privileged | 4 +++-
 lib/RT/Extension/FormTools.pm                     | 2 ++
 6 files changed, 10 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
rt-extension-formtools


More information about the Bps-public-commit mailing list