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.

Data Model Questions /

ViewersGroup is obsolete , how to check permissions now ?


Reply


3 Posts   1300 Views

Avatar
Fuzz10

Community Member, 787 Posts

17 January 2009 at 2:18am

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 ?

Avatar
dio5

Community Member, 501 Posts

5 September 2009 at 10:58pm

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

Avatar
Fuzz10

Community Member, 787 Posts

7 September 2009 at 8:17pm

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