19 March 2011 at 11:15pm
(Last edited: 19 March 2011 11:30pm),
I am trying to figure out if there is a way to hide the pages from the site tree that the logged in user cannot access.
I do not want different user groups to "peek" on each others pages.
Is there a simple way to do so?
Edit: I tried using Simplify Module, and my problem with it is when I have the following Structure:
- Page A -> User Cannot Edit
- SubPage 0 -> User Can Edit
if the Parent Page is not editable, Simplify hides it and all tis children even if a child was editable.
Is there a way to fix it?
30 March 2011 at 11:49pm
Thas has always been a discussion and as yet there is no solid solution, mainly due to the use case that you mention whereby a parent page will be hidden even if the child page is editable.
What I have done in the past is check for edit permissions in my getCMSFields() funtion and return an empty fieldset or message if not, something like so:
public function getCMSFields()
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TextField('MyText'));
$fields = new FieldSet(
new LiteralField('','<p>You cannot edit this page</p>')
It's not the ideal solution, but can work reasonably in some situations.