[rt-users] Getting a list of privileged users...
Emmanuel Lacour
elacour at easter-eggs.com
Thu Nov 19 09:02:42 EST 2009
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
}
More information about the rt-users
mailing list