[Rt-commit] rt branch, 4.4/add_assets_menu_right, created. rt-4.4.0rc2-22-gd0059e6

Jim Brandt jbrandt at bestpractical.com
Mon Jan 4 16:51:51 EST 2016


The branch, 4.4/add_assets_menu_right has been created
        at  d0059e6427cbf57c7b851401bba5a4acc9592775 (commit)

- Log -----------------------------------------------------------------
commit d0059e6427cbf57c7b851401bba5a4acc9592775
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..161c020 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' );
 

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


More information about the rt-commit mailing list