Is there a way to edit a user group's permissions to prevent them from adding and deleting pages from the site tree?
I still want Admins to have this functionality though.
Thanks
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Is there a way to edit a user group's permissions to prevent them from adding and deleting pages from the site tree?
I still want Admins to have this functionality though.
Thanks
From the lack of replies, it looks as if this isn't possible.
I really need to prevent users from creating new pages. Where in the code can I "comment out" the code for the create button?
Thanks
Hi bones,
In the Security tab in the CMS, you can create a group and assign permissions for that particular group through the Permissions tab.
Thanks for the reply, cuSSter, but there doesn't seem to be a way to remove the "Create" button from a group.
I've created a new group, tried many permutations of permissions settings, and added a new user. When I log in as that user, the "Create" button still appears at the top of the site tree.
Which of the permissions should I untick to remove the "Create Page" option?
You might try to use the page's canCreate() function and return false if the current user is not an admin. Something like:
function canCreate($Member = null) {
if (!Permission::check("ADMIN")) {
return false;
} else {
return parent::canCreate($member);
}
}
martimiz is right. Put that in Page.php and no one can create Pages unless they belong to the administrators group. Or add new permission for Page manipulation, I think it's more neat. So you can fully control which user groups will have such permissions on a page. Here's a simple tutorial on how to achieve that: http://www.balbuss.com/ under the Members and security tab.
Thanks, these look like good solutions, I'll give them a try.
Currently, for quickness, I've just commented out the "Create" button in cms/templates/includes/CMSMain_left.ss It's not an elegant solution, but it does the job.