Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Users

Getting a list of privileged users...

 

 

Request Tracker users RSS feed   Index | Next | Previous | View Threaded


johnathan.bell at baker

Nov 19, 2009, 5:33 AM

Post #1 of 2 (334 views)
Permalink
Getting a list of privileged users...

I'm running a script that grabs a list of users from our LDAP directory and synchronizes group memberships and permissions. Currently, I use code similar to this, to get a list of members:

--snip--
my $currentUser = GetCurrentUser();
my $workingUser = new RT::User($currentUser);
my $systemUser = RT::User->new($RT::SystemUser);

# RT Group
$groupObj = new RT::Group($currentUser);
$groupObj->LoadUserDefinedGroup($groupName);

if ( not $groupObj->Id() )
{
print "Group ".$groupName." not found in RequestTracker\n";
next;
}

# Get our members into an array for easy work later.
$groupMembersObj = $groupObj->MembersObj();
my @rtMembers;
while ( $groupMember = $groupMembersObj->Next() )
{
$groupMemberUser = $groupMember->UserObj();
$workingUser->Load($groupMember->MemberId());
$workingUser->Name();
push(@rtMembers, $workingUser->Name());
}
--snip--

Basically, I load a group by name, and then loop through the array and grab each user into an array. Is there a way I can do this for privileged user names? I just want to get them into an array to work with them later.

Thanks,
Johnathan

--
Johnathan Bell
Internet System Administrator, Baker College

Office Phone: 810-766-4097
Office Hours: 7A-4P, M-F

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

Community help: http://wiki.bestpractical.com
Commercial support: sales [at] bestpractical


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


elacour at easter-eggs

Nov 19, 2009, 6:02 AM

Post #2 of 2 (300 views)
Permalink
Re: Getting a list of privileged users... [In reply to]

On Thu, Nov 19, 2009 at 08:33:06AM -0500, Johnathan Bell wrote:
> I'm running a script that grabs a list of users from our LDAP directory and synchronizes group memberships and permissions. Currently, I use code similar to this, to get a list of members:
>
> --snip--
> my $currentUser = GetCurrentUser();

> my $workingUser = new RT::User($currentUser);
> my $systemUser = RT::User->new($RT::SystemUser);

those two lines are useless, $currentUser and $RT::SystemUser are
already objects, $workingUser and $systemUser are just empty users
objects

>
> Basically, I load a group by name, and then loop through the array and
> grab each user into an array. Is there a way I can do this for
> privileged user names? I just want to get them into an array to work
> with them later.
>

there is different way to do this, it depends on the final purpose, but
the simplest way to get all priviledged users is:

my $PrivilegedUsers = RT::Users->new ( $RT::SystemUser );
$PrivilegedUsers->LimitToPrivileged;

the walk this with:

while ( my $PrivilegedUser = $PrivilegedUsers->Next ) {
...things to do with user object $PrivilegedUser
}

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

Community help: http://wiki.bestpractical.com
Commercial support: sales [at] bestpractical


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

Request Tracker users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.