[rt-users] Hide Option for Tabs

Kevin Falcone falcone at bestpractical.com
Mon Feb 13 12:20:22 EST 2012


On Mon, Feb 13, 2012 at 03:19:29PM +0100, Haim Dimer wrote:
> This is my first attempt at answering a post on this list, so bear with me..
> 
> Here's an idea for a solution. In $RTHOME/local/html/Elements/Tabs you
> can put if clauses based on methods for the $session object. I don't

Please don't override html/Elements/Tabs, it's a large file and
every time you upgrade you'll need to merge your changes.

Use the Privileged or Unprivileged callbacks that we provide.

There are examples of how to do this cleanly on
http://requesttracker.wikia.com/wiki/Menus

For Pattabi's workflow, you'll want $group->HasMemberRecursively to
check if someone is in a group.

It often makes sense to optimize this code to check the membership and
then cache some information in the user's session.  We've profiled a
number of RT instances for clients where lots of extra group checks
caused page slowdowns until we added some caching in.

-kevin

> know which methods are available but I suppose you could find one that
> says "IsMember( GroupA)". Here's an example of working code just to
> get you moving.
> 
> if ( $session{'CurrentUser'}->HasRight( Right => 'AdminUsers', Object
> => RT->System ) )
>    {
>      $tools->child( reports => title => loc('Reports'), path     =>
> '/Reports/Activity/',description => loc('Activity Report') );
>    }
> 
> Haïm.
> 
> 2012/2/13 Pattabi Prasanna <escort146 at gmail.com>:
> > Hi,
> >     i want to hide certain options available in Tools Tab based on
> > User Group, for example Group A user should have that option
> > displayed, while Group B user should not find that option.
> > HideConfiguration doc works for only Configuration tab but i need for
> > other tabs, child tabs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120213/f86a0887/attachment.sig>


More information about the rt-users mailing list