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

Craig Ringer craig at 2ndquadrant.com
Wed Mar 13 06:06:54 EDT 2013


On 03/13/2013 04:40 PM, Craig Ringer wrote:
> 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();

BTW, I'm about to put up another extension that needs the behaviour in
the patch.

If I want to make it run on unpatched RT for easier distribution and
installation how would you recommend doing this? I surely don't want to
distribute a Users_Local.pm in my extension.

I think I could hot-insert the method into RT::Users with something like:

{
  package RT::Users;
  sub WhoBelongToGroupsIncludingPrivileged {
    # ....
  }
}

in my module. It doesn't have to be visible to other modules, so it'd
essentially be a method of RT::Users that's private to my extension.

Is this a sane approach? My Perl is still a bit rusty, so I wanted to
check before putting anything out in the wild.

-- 
 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/cbfd8c1e/attachment.htm>


More information about the rt-users mailing list