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

Bauer, Felix bauer at dmsb.de
Wed Mar 17 08:23:28 EST 2004


Maybe you have a closer look to the camelbook chapter 12 and learn about
class inheritance, which is IMHO a pain in the ass, but that's the way oo works :)

> -----Ursprüngliche Nachricht-----
> Von: Todd Chapman [mailto:rt at chaka.net]
> Gesendet: Mittwoch, 17. März 2004 13:01
> An: Ruslan U. Zakirov
> Cc: rt-users at lists.fsck.com
> Betreff: Re: [rt-users] How to go from id to User or Group?
> 
> 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
> _______________________________________________
> 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