[rt-users] Privileged Users

Mathew Snyder theillien at yahoo.com
Sat Nov 18 00:47:17 EST 2006


Cool, thanks.  It never occurs to me to to look at the API and try to sort it
out.  I guess that's why I'm going to the training in Boston ;)

I ran this though and got the following error:
Undefined subroutine &main::CleanEnv called at ./report_test2.pl line 6.

Mathew

Roy El-Hames wrote:
> Mathew;
> I am assuming your RT is in /opt/rt3
> So what you need is:
> 
> #!/usr/bin/perl
> use lib "/opt/rt3/lib";
> use RT;
> use RT::Users ; ## you may not need this but what the he
> use warnings;
> CleanEnv();   ##Clening the env
> RT::LoadConfig();   ## Loading RT config
> RT::Init();    ## Initialise RT
> 
> my $users = new RT::Users(RT_System);
> $users->LimitToPrivileged;
> 
> while ( $user = $users->Next) {
>    print $user->Name ;
> }
> exit;
> 
> stick in /opt/rt3/bin and run it; it should work.
> 
> Roy
> 
> 
> 
> Mathew Snyder wrote:
>> I've created a simple script and placed it in local/sbin.  When I run
>> it I get "Can't locate
>> RT/Users.pm in @INC...".  How do I add RT to the list of @INC
>> directories?
>>
>> Of course, my perl skills are still rudimentary at best so I may have
>> it all wrong:
>> #!/usr/bin/perl
>> use RT::Users;
>> use strict;
>> use warnings;
>>
>> my $users = new RT::Users(RT_System);
>> $users->LimitToPrivileged;
>> print $users;
>>
>> Mathew
>>
>> Roy El-Hames wrote:
>>  
>>> Mathew;
>>> Querying the database will be complex involving Users and Principals
>>> tables and *I think* you may need to also include the Groups table, will
>>> be much simpler to use the RT  API , the function you need will be
>>> somthing like:
>>> use RT::Users
>>> my $users = new RT::Users(RT_System);
>>> $users->LimitToPrivileged;
>>> (look in (Admin/Users/index.html)
>>> Regards;
>>> Roy
>>>
>>> Mathew Snyder wrote:
>>>    
>>>> I'm trying to get a list of all privileged users in our system.  Which
>>>> table.field should I be querying against?
>>>>
>>>>
>>>> Mathew
>>>> _______________________________________________
>>>> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>>>>
>>>> Community help: http://wiki.bestpractical.com
>>>> Commercial support: sales at bestpractical.com
>>>>
>>>>
>>>> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
>>>> Buy a copy at http://rtbook.bestpractical.com
>>>>
>>>>         
>>>     
>>
>>   
> 
> 



More information about the rt-users mailing list