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   1214 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, 5513 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, 5513 Posts

4 July 2008 at 11:25am

Thanks :)