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.

Archive

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

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

Members.php fix ?


Reply

4 Posts   1169 Views

Avatar
ScottiouS

3 July 2008 at 3:36pm (Last edited: 3 July 2008 3:36pm), Community Member, 54 Posts

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

3 July 2008 at 4:01pm Forum Moderator, 5511 Posts

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

3 July 2008 at 6:19pm Community Member, 54 Posts

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

Avatar
Willr

4 July 2008 at 11:25am Forum Moderator, 5511 Posts

Thanks :)