[Rt-devel] [BUG ?] When zero is one.

Todd Chapman todd at chaka.net
Thu Oct 13 19:06:42 EDT 2005


On Thu, Oct 13, 2005 at 06:53:12PM -0400, Todd Chapman wrote:
> Jesse and all,
> 
> Why doesn RT::System::id return 1 when in the Groups table all
> the Role groups for the RT::System Domain have Instance set to 1?

What I mean to say is, why does RT::System::id return 1 when in the Groups
table all the Role groups for the RT::System Domain have Instance set to 0?

> 
> This bit me because I was building an ACL query (as Jesse mentioned)
> and I needed the principal Id for the correct role account.
> 
> This seems to be the one case where the object id and the instance
> are not the same.
> 
> Am I missing something?
> 
> Thanks.
> 
> sub _RealPrincipal {
>     my $self = shift;
> 
>     my %args = @_;
>     #get the real principal
>     my $groups = RT::Groups->new($RT::SystemUser);
>     $groups->Limit(FIELD => 'Domain',   VALUE => ref($args{Object}) . '-Role' );
>     $groups->Limit(FIELD => 'Instance', VALUE => $args{Object}->id );
>     $groups->Limit(FIELD => 'Type',     VALUE => $self->{Role} );
> 
>     if ($groups->Count) {
>         return $groups->First->PrincipalObj;
>     }
>     else {
>         $RT::Logger->debug("No group found for Domain: " . ref($args{Object}) . '-Role Instance: ' . $args{Object}->id . ' Type: ' . $self->{Role});
>     }
>     return;
> }
> 
> _______________________________________________
> Rt-devel mailing list
> Rt-devel at lists.bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel


More information about the Rt-devel mailing list