[rt-users] How to enumerate users

Ruediger Riediger ruediger.riediger at sun.com
Thu Nov 18 10:10:59 EST 2004


Ruslan U. Zakirov wrote:
>> we want to enumerate (regularly) all users existing in RT3.0.12 to 
>> refresh the information (work phone, address, etc) from an LDAP server.
>> Obviously, a "/opt/rt3/bin/rt show user/1-9999" would do, but it would 
>> be very resource intensive %-)
>>
>> Is there a way to pull all users, one at a time?
> 
> As far as I understand your task, then you don't want to pull info from RT.
> You require CLI that allow you update users info. And script that 
> fetches info from LDAP and execute script that updates user record.
> 
> Small example that updates user info:
> 
> ...
> use RT::User;
> my $u_obj = RT::User->new( $RT::SystemUser );
> $u_obj->Load( 'foo at example.com' );
> die "No user" unless( $u_obj->id );
> 
> $u_obj->Set( Field => 'RealName', Value => 'Foo Z. Bar' );
> ...

Close to it. How do we know which users to load? We do not want to go 
over all what is in LDAP but rather each user in RT, like

for ($i=1; $i++; ...)
{
	$u_obj->Load( $i );
	next unless ($u_obj->id)
}

The problem is: how to run through all users while skipping the gaps. 
And as there are gaps, when to stop?

Best regards,

	Ruediger Riediger

-- 
Dr. Ruediger Riediger                              Sun Microsystems GmbH
NSG - SunCERT                                             Komturstr. 18a
mailto:Ruediger.Riediger at Sun.com                          D-12099 Berlin
------------------------------------------------------------------------
NOTICE:  This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
------------------------------------------------------------------------
PGP 2048RSA/0x2C5020E9          964C E189 0FF0 8882  2BAB 65E2 6912 1FF2
------------------------------------------------------------------------



More information about the rt-users mailing list