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

Todd Chapman rt at chaka.net
Wed Mar 17 07:00:44 EST 2004


Thanks. I guess its time to learn the magic of DBIx::SearchBuilder!

-Todd

On Wed, Mar 17, 2004 at 03:23:41PM +0300, Ruslan U. Zakirov wrote:
> Todd Chapman wrote:
> >Where is RT:Principal inheriting Load from? I don't see it?
> Finaly from DBIx::SearchBuilder package.
> RT::Principal isa RT::Record isa DBIx::SearchBuilder::Record
> >
> >Thanks!
> >
> >-Todd
> >
> >On Wed, Mar 17, 2004 at 12:32:38PM +0300, Ruslan U. Zakirov wrote:
> >
> >>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