Jump to:

3433 Posts in 1058 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » ViewersGroup is obsolete , how to check permissions now ?

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

Page: 1
Go to End
Author Topic: 1276 Views
  • Fuzz10
    Avatar
    Community Member
    787 Posts

    ViewersGroup is obsolete , how to check permissions now ? Link to this post

    According to the upgrade notes for 2.3 on this page : http://doc.silverstripe.com/doku.php?id=upgrading:2.3.0&s=viewersgroup , the Page->ViewersGroup and Page->EditorsGroup have been changed to a many_many relation..

    This breaks some functionality in one of our sites and I don't know how to properly make it work in SS 2.3 ...

    What I need is a list of all the pages that have a specific "viewersgroup" permission set. In the old situation , I could just do a $GroupPage = DataObject::get_one("Page", "ViewersGroup = '$Group->ID'", "Sort", ""); to get the results.

    From 2.3 on , the ViewersGroup DB column is obsolete and replaced by a many-many relation. So basically , I need to do a reverse lookup on these values but I can't figure out how to do it.

    Anyone has the answer ?

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: ViewersGroup is obsolete , how to check permissions now ? Link to this post

    And, how did you solve it?

    Running into the same issue on an old site - current solution I see is rewriting everything using JOINS, but perhaps you found an even easier solution?

    cheerz

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: ViewersGroup is obsolete , how to check permissions now ? Link to this post

    I first get the group for the current user : Member->Groups()

    Then , I loop through the pages and match their viewergroups against my user group .....

    You can do a $page->getManyManyComponents('ViewerGroups') to get a list of all viewergroups for page..

    I can probably dig up some code somewhere if you need it .....

    1276 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.