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.
Maybe I need to first build a Group?
Thanks!
-Todd
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.
Where is RT:Principal inheriting Load from? I don’t see it?
Thanks!
-ToddOn 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@lists.bestpractical.com
The rt-users Archives
Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm
Thanks. I guess its time to learn the magic of DBIx::SearchBuilder!
-ToddOn 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@lists.bestpractical.com
The rt-users Archives
Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm