Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Members.php fix ?


Go to End


4 Posts   1455 Views

Avatar
ScottiouS

Community Member, 54 Posts

3 July 2008 at 3:36pm

Edited: 03/07/2008 3:36pm

I've come across a function that I think may be wrong.

Consider changing

public function inGroups(array $groups) {
foreach($this->Groups() as $group)
$memberGroups[] = $group->Title;

return count(array_intersect($memberGroups, $groups)) > 0;
}

To:

public function inGroups(array $groups) {
foreach($this->Groups() as $group)
$memberGroups[] = $group->ID;

return count(array_intersect($memberGroups, $groups)) > 0;
}

To check a member's permissions by group Title is unreliable as a title can duplicated.

Avatar
Willr

Forum Moderator, 5523 Posts

3 July 2008 at 4:01pm

Make a ticket for this on open.silverstripe.com and submit this as a patch (instructions on open.silverstripe.com) then when somebody goes through the patchs and merges back / checks (usually someone does it twice a month or something) it will be reviewed / updated :D

Have you tested it? any side effects for uses in more then 1 group etc

Avatar
ScottiouS

Community Member, 54 Posts

3 July 2008 at 6:19pm

Yeah tested on an instance with multiple groups. Will submit as patch.

Avatar
Willr

Forum Moderator, 5523 Posts

4 July 2008 at 11:25am

Thanks :)