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.

Customising the CMS /

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

Show Pages that the user Can Acess

Go to End

3 Posts   1378 Views


Community Member, 18 Posts

19 March 2011 at 11:15pm

Edited: 19/03/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?

Carbon Crayon

Community Member, 598 Posts

30 March 2011 at 11:49pm

Hi Jsaade,

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>')
		return $fields;

It's not the ideal solution, but can work reasonably in some situations.



Community Member, 18 Posts

12 April 2011 at 8:02pm

I used simplify + Security Groups and it works, after a lot of tweaking.