[rt-devel] Users::WhoHaveRight and Sybase

Jesse Vincent jesse at bestpractical.com
Mon Jun 30 15:55:18 EDT 2003



On Mon, Jun 30, 2003 at 03:48:26PM -0400, Audley, Christopher wrote:
> I had the where GroupId = NULL in there just as a lazy way to ensure valid SQL even when the array of groups was undefined or empty.  It seemed harmless enough, GroupId in GroupMembers is 'NOT NULL', although its not in CachedGroupMembers, it seemed unlikely this would ever cause a false match.
> 
> I wan't sure if you'd want a subquery inside of Users->WhoHaveRight, so I just through this together assuming it would be revised before accepted.

Ah. Ok. I'm glad I wasn't just missing something subtle. The Searchbuilderish 
way to have it generate correct SQL is to use the Limit method inside the loop like this:

foreach my $groupid (@{$args{'Groups'}}) {
        $self->Limit(ALIAS => $cgm, FIELD => 'GroupId', VALUE => $groupid, QUOTE VALUE => 0, ENTRYAGGREGATOR=> 'OR')
}

> Cheers

-- 
http://www.bestpractical.com/rt  -- Trouble Ticketing. Free.



More information about the Rt-devel mailing list