Jump to:

5552 Posts in 1742 Topics by 1226 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Checking Permission only inside a specific given Group

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

Page: 1
Go to End
Author Topic: 1134 Views
  • neros3
    Community Member
    51 Posts

    Checking Permission only inside a specific given Group Link to this post

    My users are allowed to be in several Groups. But a BLOG_MANAGEMENT permission inside one Groups doesn't mean they are allowed the same actions inside another Group. So I only want to check for a specific Group. I know this is sounds a little strange, since this is not the normal procedure for dealing with security.
    Another problem is afterwards, what about my admin account. I would like for "him" to stay super user and allowed CRUD actions all over the site.

    Does anyone know how to do this?

    Permission::GroupCheck("BLOG_MANAGEMENT", null) or something similar?

    Been looking at the $arg argument to Permission::Check - But I fear that its deprecated or at least about to be and I'm not really sure if this is what I need?

    Hope you can help.

    Thank you!

  • PGiessler
    Community Member
    47 Posts

    Re: Checking Permission only inside a specific given Group Link to this post

    Hi neros3,

    first of all, I want to give you a short overiew about the permission system of silverstripe. If you want to check the rights for a member in a specific group, you have to call the method Permission:check('BLOG_MANAGEMENT','any',$member). But instead of using 'BLOG_Management' you should use a specific rule like 'BLOG_MANAGEMENT_CAN_EDIT_ALL'. But also you can get the list of group of member, by using Permission::groupList($memberID) to check if the given user is in the group.

    Also If you want to provide your own rules, you can extend your DataObject with DataObjectDecorator and implement PermissionProvider. In the method providePermission, you set the array of new permissions.

    I hope I could help you. But if there are any question, please feel free to ask.

    Best, Pascal

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.