[Rt-commit] rt branch, 4.4.0-releng, updated. rt-4.4.0rc2-6-gba48835

Shawn Moore shawn at bestpractical.com
Tue Jan 5 15:18:34 EST 2016


The branch, 4.4.0-releng has been updated
       via  ba48835d73fa3e81a770a927f24cba5d77eaad84 (commit)
      from  3aa6c695906ec98bf96798d04dd1c8a8eed6f1d8 (commit)

Summary of changes:
 docs/UPGRADING-4.4                   |  6 ++++++
 docs/assets.pod                      |  7 ++++++-
 docs/customizing/assets/tutorialdata |  7 +++++++
 lib/RT/System.pm                     |  1 +
 share/html/Elements/Tabs             | 14 +++++++++-----
 5 files changed, 29 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit ba48835d73fa3e81a770a927f24cba5d77eaad84
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Mon Jan 4 16:49:34 2016 -0500

    Add new ShowAssetsMenu right to manage visibility of Assets menu
    
    While Assets is now a core feature, not all RT users may want to
    use it. Create a right to hide it similar to the handling for
    Articles.

diff --git a/docs/UPGRADING-4.4 b/docs/UPGRADING-4.4
index 24ca831..f19c493 100644
--- a/docs/UPGRADING-4.4
+++ b/docs/UPGRADING-4.4
@@ -46,6 +46,12 @@ functionality. Assets documentation can be found at F<docs/assets.pod>.
 A tutorial on customizing your Assets install can be found at
 F<docs/customizing/assets/tutorial.pod>.
 
+To cleanly hide it from upgrading RT installs, the Assets menu is controlled
+by the right ShowAssetsMenu. This right is only grantable globally to groups
+or users. If you were previously using the Assets extension, you can grant the
+ShowAssetsMenu right to Privileged or another role or group to make the menu
+visible.
+
 Users who are currently using the
 L<RT::Extension::Assets|https://bestpractical.com/assets/> extension
 should remove C<RT::Extension::Assets> from the plugin list and run the
diff --git a/docs/assets.pod b/docs/assets.pod
index 3ef0ec2..5a959eb 100644
--- a/docs/assets.pod
+++ b/docs/assets.pod
@@ -54,7 +54,12 @@ add it to the catalogs you want or make it global.
 There are three rights controlling basic access to assets and two for
 catalogs.  Each right is grantable at the global level or individual catalog
 level, and grantable to system groups, asset roles, user groups, and individual
-users (just like ticket and queue rights).
+users (just like ticket and queue rights). Visibility of the Assets menu item
+itself is also controlled with a right.
+
+=head3 ShowAssetsMenu
+
+Control visibility of the Assets menu in RT.
 
 =head3 ShowAsset
 
diff --git a/docs/customizing/assets/tutorialdata b/docs/customizing/assets/tutorialdata
index 2589e82..675ed19 100644
--- a/docs/customizing/assets/tutorialdata
+++ b/docs/customizing/assets/tutorialdata
@@ -61,6 +61,13 @@
     },
 );
 
+push @ACL,
+        {
+            Right       => 'ShowAssetsMenu',
+            GroupDomain => 'SystemInternal',
+            GroupType   => 'Privileged',
+        };
+
 push @ACL, map {
         {
             Right       => $_,
diff --git a/lib/RT/System.pm b/lib/RT/System.pm
index a11b4f1..78392ab 100644
--- a/lib/RT/System.pm
+++ b/lib/RT/System.pm
@@ -88,6 +88,7 @@ __PACKAGE__->AddRight( Staff   => ModifySelf          => "Modify one's own RT ac
 __PACKAGE__->AddRight( Staff   => ShowArticlesMenu    => 'Show Articles menu'); # loc
 __PACKAGE__->AddRight( Admin   => ShowConfigTab       => 'Show Admin menu'); # loc
 __PACKAGE__->AddRight( Admin   => ShowApprovalsTab    => 'Show Approvals tab'); # loc
+__PACKAGE__->AddRight( Staff   => ShowAssetsMenu      => 'Show Assets menu'); # loc
 __PACKAGE__->AddRight( Staff   => ShowGlobalTemplates => 'Show global templates'); # loc
 __PACKAGE__->AddRight( General => LoadSavedSearch     => 'Allow loading of saved searches'); # loc
 __PACKAGE__->AddRight( General => CreateSavedSearch   => 'Allow creation of saved searches'); # loc
diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 48a72ac..8351eca 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -578,7 +578,8 @@ my $build_main_nav = sub {
 
     $search->child( users => title => loc('Users'),   path => "/User/Search.html" );
 
-    $search->child( assets => title => loc("Assets"), path => "/Asset/Search/" );
+    $search->child( assets => title => loc("Assets"), path => "/Asset/Search/" )
+        if $session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
 
     if ($session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System )) {
         my $articles = Menu->child( articles => title => loc('Articles'), path => "/Articles/index.html");
@@ -588,9 +589,11 @@ my $build_main_nav = sub {
         $articles->child( search   => title => loc('Search'),   path => "/Articles/Article/Search.html" );
     }
 
-    my $assets = Menu->child( "assets", title => loc("Assets"), path => "/Asset/Search/" );
-    $assets->child( "create", title => loc("Create"), path => "/Asset/CreateInCatalog.html" );
-    $assets->child( "search", title => loc("Search"), path => "/Asset/Search/" );
+    if ($session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System )) {
+        my $assets = Menu->child( "assets", title => loc("Assets"), path => "/Asset/Search/" );
+        $assets->child( "create", title => loc("Create"), path => "/Asset/CreateInCatalog.html" );
+        $assets->child( "search", title => loc("Search"), path => "/Asset/Search/" );
+    }
 
     my $tools = Menu->child( tools => title => loc('Tools'), path => '/Tools/index.html' );
 
@@ -1129,7 +1132,8 @@ my $build_selfservice_nav = sub {
     $tickets->child( open   => title => loc('Open tickets'),   path => '/SelfService/' );
     $tickets->child( closed => title => loc('Closed tickets'), path => '/SelfService/Closed.html' );
 
-    my $assets = Menu->child( "assets", title => loc("Assets"), path => "/SelfService/Asset/" );
+    Menu->child( "assets", title => loc("Assets"), path => "/SelfService/Asset/" )
+        if $session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
 
     my $username = '<span class="current-user">'
                  . $m->interp->apply_escapes($session{'CurrentUser'}->Name, 'h')

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


More information about the rt-commit mailing list