Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Members.php fix ?

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

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

Page: 1
Go to End
Author Topic: 1161 Views
  • ScottiouS
    Avatar
    Community Member
    54 Posts

    Members.php fix ? Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: Members.php fix ? Link to this post

    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

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

  • ScottiouS
    Avatar
    Community Member
    54 Posts

    Re: Members.php fix ? Link to this post

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

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: Members.php fix ? Link to this post

    Thanks

    1161 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.