[dev] lib/Perms.php:getPermissions group issue

Chuck Hagenbuch chuck at horde.org
Wed Dec 17 17:34:38 PST 2003


Quoting "W. David Betts" <david at populus.com>:

> I ran into a problem, maybe somebody knows what the issue is.  In
> lib/Perms.php:getPermissions it checks to see if the user is in one of the
> groups associated with the permission by using the call
> $groups->userIsInGroup($user, $groups->getGroupName($group))
> where $groups is a &Group::singleton() and $group comes from
> $permission->data['groups'].
>
> This doesn't work on my copy of cvs HEAD, but the call
> $groups->userIsInGroup($user, $group) does work.
> >From what I can tell Perms.php has had the getGroupName call since v 1.44.

Okay, after some further digging, the getGroupName() call is correct, because:

1. We *should* be storing a group ID (not name) everywhere we store groups (for
permissions or otherwise). We may not be, however, and anywhere we're not, we
need to fix that.

2. Group::userIsInGroup() expects a group name, so we need to translate the id
before calling it.

That's my analysis; hope it helps someone.

-chuck

--
Charles Hagenbuch, <chuck at horde.org>
"I'm really... I'm not too fascinated by green food." - Average Joe


More information about the dev mailing list