[rt-users] [PATCH] RT::Users->WhoBelongToGroups applies LimitToPrivileged filter

Craig Ringer craig at 2ndquadrant.com
Wed Mar 13 04:40:22 EDT 2013


Hi all

I've noticed that the WhoBelongToGroups method of user search class
RT::Users unconditionally calls LimitToPrivileged, making it useless for
when you want to find both privileged and unprivileged users, or when
you want to find only unprivileged users where you've already called
LimitToUnprivileged . This behaviour isn't documented and there's a comment:

    # Unprivileged users can't be granted real system rights.
    # is this really the right thing to be saying?
    $self->LimitToPrivileged();

that suggests uncertainty about whether it's correct.

I'm running 4.07 but this code remains in 4.10 and in 4.2 git master HEAD.

The attached patch documents the current behaviour and adds a flag to
override it per-call. It applies to 4.0 and master HEAD. A pull request
has been sent with the changes:

https://github.com/bestpractical/rt/pull/47

Filed as RT ticket 22989.

Anyone who wants to apply this change in the mean time can do so by
grabbing lib/RT/Users.pm, extracting the WhoBelongToGroups method from
it, and adding it to $localrtlib/RT/Users_Local.pm like this:

-----
use strict;
no warnings qw(redefine);
package RT::Users;

# paste WhoBelongToGroups method here

1;
----


-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130313/9efecca6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Allow-RT-Users-WhoBelongToGroups-to-optionally-retur.patch
Type: text/x-patch
Size: 2225 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130313/9efecca6/attachment.bin>


More information about the rt-users mailing list