[rt-users] How to go from id to User or Group?

Ruslan U. Zakirov cubic at acronis.ru
Wed Mar 17 04:32:38 EST 2004


Todd Chapman wrote:
> I'm writing a scrip that will run when an AddWatcher
> transaction happens. The NewValue is the Id of the user
> or group that is being added. I need to check if the
> Id belongs to a user or a group and then take the
> appropriate action.
> 
> I probably need to to create a Principal object and
> then check the type but I can't figure out how. There
> is no Load method for Principal.
Yes, you could use this Id to create Principal object.
my $PObj = new RT::Principal( $session{'CurrentUser'});
$PObj->Load($id);

Also each RT user has ACL_Equvivalence group in Group table.
Groups.id == Principals.id allways. Principals.ObjectId is not used any 
more.
So you could load Group object with id also.

I think you need principal obj because it has IsGroup method.

> 
> Maybe I need to first build a Group?
> 
> Thanks!
> 
> -Todd
> _______________________________________________
> rt-users mailing list
> rt-users at lists.bestpractical.com
> http://lists.bestpractical.com/mailman/listinfo/rt-users
> 
> Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm




More information about the rt-users mailing list