[rt-users] Conditionalize "Configuration" tab based on user rights

bill at daze.net bill at daze.net
Tue Apr 1 18:35:40 EST 2003


Hello all.

Boy do I have a lot to learn... Mason, RT3 design, local customizations,
etc...  As I mentioned in an earlier message, after a few years of using
a highly customized RT1.x, we finally made the move to the latest RT.

Anyway, I have done a lot of customizations (all in the local dir of
course--I want to make upgrades easy this time around) via trial and
error hacking existing files.

I've got the QuickSearch showing only queues the user has access to.
I've modified the contrib MyQueues to work with RT3.
I've made a stripped down "printable version" of ShowHistory since our
staff likes to print certain tickets.

Now I'm trying to restrict access to the entire "Configuration" option to
user's with specific rights.  Basically we only want the option to appear
if the logged in user has SuperUser rights (for lack of a better right).

I haven't had much luck with this.  The best I've been able to do is
conditionally display it based on user name--which requires hardcoding in
the file.  Below is my code excerpt from my local version of
/Elements/Tab.  If someone can point out how to access CurrentUserHasRights
from this code, and perhaps a more elegant way of coding it (it would be
nice be able to just add "configuration" to $basetabs when
CurrentUserHasRight('SuperUser'), I would appreciate it.

#if ($session->CurrentUserHasRight('SuperUser')) {  ### this doesn't work
if ($session{'CurrentUser'}->Name eq "blg") {
  $basetabs = {     A => { title => loc('Homepage'),
                           path => '',
                         },
                    B => { title => loc('Tickets'),
                        path => 'Search/Listing.html'
                      },
                    E => { title => loc('Configuration'),
                          path => 'Admin/'
                         },
                    K => { title => loc('Preferences'),
                        path => 'User/Prefs.html'
                      },
                    P => { title => loc('Approval'),
                           path => 'Approvals/'
                         },
                 };
} else {
  $basetabs = {     A => { title => loc('Homepage'),
                           path => '',
                         },
                    B => { title => loc('Tickets'),
                        path => 'Search/Listing.html'
                      },
                    K => { title => loc('Preferences'),
                        path => 'User/Prefs.html'
                      },
                    P => { title => loc('Approval'),
                           path => 'Approvals/'
                         },
                 };
}


Thanks!

--
"If Verisign is the 'Value of Trust',
  then trust ain't worth much any more." - me

Spam Trap Mail Key: ASK and you shall receive




More information about the rt-users mailing list