What permissions should be granted to user to enable logging in and edit specific pages but to prevent him/her from creation of the top level pages?
It looks like Access to SiteContent allows creation of top level pages
Thank you
Victor
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.
What permissions should be granted to user to enable logging in and edit specific pages but to prevent him/her from creation of the top level pages?
It looks like Access to SiteContent allows creation of top level pages
Thank you
Victor
Don't think SilverStripe does this out of the box, you could do something with onBeforeWrite to check the members Group before allowing the write to the database.
I think you should write a custom canCreate method for your Page Class. There you would check Page-Level and Usergroup and grant/deny accordingly.
Sorry, disregard my previous post. The canCreate approach isn't going to work, unless you figure out a way to determine which Page is currently selected in the SiteTree (I would be interested to know this as well).
A thing that's going to work is overriding the canPublish method. This won't prevent the user from creating Pages, but you can make sure that he can never publish them at top level.
Would the onBeforeWrite method work to prevent users creating pages at all? I would rather limited users not be able to do this in the CMS rather than having a bunch of unwanted drafts they can never publish.
Please let me know. Thanks!
I'm having the same issue. Did anyone find a solution?
Well this is one solution I found, though I'm not proud of it and I'm sure there are better ways that I'm yet to discover.
With this method, you set up the root pages you need first, then once created add this line to your Page class:
static $can_be_root = false;
This then locks out the possibilty of creating any more pages in root. The only issue is that this is global i.e. for all users including admin.
To create more pages, you'd have to set it to true and probably need to do a /dev/build.
I'm gonna stick with this option for now, but am definitely open to a more flexible approach.
Looking at 2.4 beta 1 with CMS workflow I see
Who can create pages in the root of the site?
with 2 radio buttons
* Anyone who can log-in to the CMS
* Only these people (choose from list)
So we decided just to wait until 2.4 release before extending list of people with access
Victor