Allow only a specific user to see a Callback

Dear all,

I would like only a specific user, e.g ‘John’ to see a callback.

Currently I only see methods based on user rights, like:

<%INIT>
if ($session{‘CurrentUser’}->UserObj->HasRight(
Right => ‘AdminUsers’,
Object => $RT::System,
)) {
$toptabs->{‘My Callback’} = { title =>loc(“My Callback”),
path => “MyCallbacks/1/index.html” };
}
</%init>
<%args>
$toptabs =>undef
</%args>

I want only ‘John’ to see this callback, not everybody that has
’AdminUsers’ right.

Your help is much appreciated!

Cheers,
merou

Dear all,

I would like only a specific user, e.g ‘John’ to see a callback.

Currently I only see methods based on user rights, like:

<%INIT>
if ($session{‘CurrentUser’}->UserObj->HasRight(
Right => ‘AdminUsers’,
Object => $RT::System,
)) {
$toptabs->{‘My Callback’} = { title =>loc(“My Callback”),
path => “MyCallbacks/1/index.html” };
}
</%init>
<%args>
$toptabs =>undef
</%args>

I want only ‘John’ to see this callback, not everybody that has
’AdminUsers’ right.

Your help is much appreciated!

Cheers,
merou

I’m no RT API expert, but I think from a best practices standpoint you
really ought to create a new group for the purpose, make ‘John’ a member of
that group, and then have the scrip allow the callback based on membership
in that group.

holland holland wrote:

Dear all,

I would like only a specific user, e.g ‘John’ to see a callback.

Currently I only see methods based on user rights, like:

<%INIT>
if ($session{‘CurrentUser’}->UserObj->HasRight(
Right => ‘AdminUsers’,
Object => $RT::System,
)) {
$toptabs->{‘My Callback’} = { title =>loc(“My Callback”),
path => “MyCallbacks/1/index.html” };
}
</%init>
<%args>
$toptabs =>undef
</%args>

I want only ‘John’ to see this callback, not everybody that has
’AdminUsers’ right.

Your help is much appreciated!

Cheers,
merou


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

– ============================
Tom Lahti
BIT Statement LLC

(425)251-0833 x 117
http://www.bitstatement.net/
– ============================

I think you can also get the current user`s obj and get his name like : $session{‘CurrentUser’}->UserObj->Name and put in a condition to see if its John or not. Based on this condition you should call the callback.

But going into the future if you want to add more users this functionality, it makes sense to create a new group.
Then you should put in a condition to see iif the current user is a part of this new group.

-AshishFrom: rt-users-bounces@lists.bestpractical.com [rt-users-bounces@lists.bestpractical.com] On Behalf Of Tom Lahti [toml@bitstatement.net]
Sent: Tuesday, March 24, 2009 4:54 AM
To: holland holland
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Allow only a specific user to see a Callback

I’m no RT API expert, but I think from a best practices standpoint you
really ought to create a new group for the purpose, make ‘John’ a member of
that group, and then have the scrip allow the callback based on membership
in that group.

holland holland wrote:

Dear all,

I would like only a specific user, e.g ‘John’ to see a callback.

Currently I only see methods based on user rights, like:

<%INIT>
if ($session{‘CurrentUser’}->UserObj->HasRight(
Right => ‘AdminUsers’,
Object => $RT::System,
)) {
$toptabs->{‘My Callback’} = { title =>loc(“My Callback”),
path => “MyCallbacks/1/index.html” };
}
</%init>
<%args>
$toptabs =>undef
</%args>

I want only ‘John’ to see this callback, not everybody that has
’AdminUsers’ right.

Your help is much appreciated!

Cheers,
merou


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

– ============================
Tom Lahti
BIT Statement LLC

(425)251-0833 x 117
http://www.bitstatement.net/
– ============================
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Try this in your condition and let me know :

if ($group->HasMemberRecursively($session{‘CurrentUser’}->PrincipalObj)) {

-AshishFrom: holland holland [lahollande@gmail.com]
Sent: Tuesday, March 24, 2009 3:55 PM
To: Potla, Ashish Bassaliel
Subject: Re: [rt-users] Allow only a specific user to see a Callback

Thanks Ashish -

I tried Tom suggestion but it does not seem to work either, the code:

my $group = new RT::Group($session{‘CurrentUser’});
$group->LoadUserDefinedGroup(‘my_group’);
if ($group->HasMemberRecursively($session{‘CurrentUser’})) {
$toptabs->{‘My Callback’} = { title =>loc(“My Callback”),
path => “MyCallbacks/1/index.html” };
}

User ‘john’ belong to ‘my_group’, but unfortunately he cannot see ‘My
Callback’, I 'm doing something wrong?

Thanks for the answers so far.

p.s: i always clean mason cache and restart apache process when testing.
I use RT 3.6.4

Cheers,
merou