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

Todd Chapman todd at chaka.net
Thu Oct 13 18:53:12 EDT 2005


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?

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;
}



More information about the Rt-devel mailing list