21309 Posts in 5738 Topics by 2603 members
| Go to End | Next > | |
| Author | Topic: | 1979 Views |
-
How to prevent user from creating top level pages?

8 December 2009 at 9:32am
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
-
Re: How to prevent user from creating top level pages?

14 January 2010 at 7:21pm
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.
-
Re: How to prevent user from creating top level pages?

14 January 2010 at 8:16pm
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.
-
Re: How to prevent user from creating top level pages?

14 January 2010 at 8:33pm
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. -
Re: How to prevent user from creating top level pages?

4 March 2010 at 10:35pm
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!
-
Re: How to prevent user from creating top level pages?

11 March 2010 at 9:34am
I'm having the same issue. Did anyone find a solution?
-
Re: How to prevent user from creating top level pages?

11 March 2010 at 11:10pm
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.
-
Re: How to prevent user from creating top level pages?

12 March 2010 at 12:48am
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
| 1979 Views | ||
| Go to Top | Next > |





