[rt-users] Privileged Users

Raed El-hames r at elhames.co.uk
Sat Nov 18 15:01:34 EST 2006


Mathew;
hmm not sure it ran ok with 3.4.4 ..
Remove the line
CleanEnv();
its not that nesseccary
Roy
----- Original Message ----- 
From: "Mathew Snyder" <theillien at yahoo.com>
To: "Roy El-Hames" <rfh at pipex.net>
Cc: <rt-users at lists.bestpractical.com>
Sent: Saturday, November 18, 2006 5:47 AM
Subject: Re: [rt-users] Privileged Users


> 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
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>
> _______________________________________________
> 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
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.409 / Virus Database: 268.14.7/537 - Release Date: 17/11/2006
>
> 




More information about the rt-users mailing list