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

Jesse Vincent jesse at bestpractical.com
Fri Oct 14 13:51:34 EDT 2005




On Thu, Oct 13, 2005 at 09:55:05PM -0400, Todd Chapman wrote:
> And what will the Instance for the General queue become?

Why would it change from 1?

> I worked around it with:
> 
> ref($object) =~ /::System$/ ? 0 : $object->id;
> 
> 
> On Thu, Oct 13, 2005 at 08:27:00PM -0400, Jesse Vincent wrote:
> > 'Bad design'
> > It should get fixed, but probably for 3.7.
> > 
> > I think 1 is the right value longterm as a 0 value can be confused for an empty value rather easily.
> > Jesse
> > 
> > Best,
> > Jesse
> > 
> > -----Original Message-----
> > From: Todd Chapman <todd at chaka.net>
> > Date: Thursday, Oct 13, 2005 6:53 pm
> > Subject: [Rt-devel] [BUG ?] When zero is one.
> > 
> > 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;
> > }
> > 
> > _______________________________________________
> > 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