21489 Posts in 5783 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1069 Views |
-
How to set security permissions by Page Type?

15 February 2010 at 8:52pm
Hello,
I have created a new page type and its associated data model. Now I want to create a user which should have access to add/edit this particular page type only.
Is this possible in SS? How do I go about it?
Thanks You.
-
Re: How to set security permissions by Page Type?

16 February 2010 at 12:14am
Thank you for the response. I have already gone through that particular page but it left quite confused.
Please see my code below. I added new permission and it shows up fine in the CMS when I try to add a new role. The problem is that if I allow just "Add/edit/delete Jobs" to a new role, that user is unable to access the CMS admin panel.
class Vacancies extends Page {
static $db = array();
static $has_many = array('Jobs' => 'Job');
static $allowed_children = array('none');
static $can_be_root = true;function getCMSFields() {
$fields = parent::getCMSFields();
$jobsTable = new ComplexTableField($this, 'Jobs', 'Job');
$fields->addFieldToTab("Root.Content.Jobs", $jobsTable);return $fields;
}
}class Vacancies_Controller extends Page_Controller {
function init() {
if(!Permission::check("JOB_EDITOR")) Security::permissionFailure();
}function ActiveJobs() {
return DataObject::get("Job", "ExpiryDate > '".date('Y-m-d')."'");
}function providePermissions(){
return array(
"JOB_EDITOR" => "Add/edit/delete Jobs"
);
}
} -
Re: How to set security permissions by Page Type?

24 August 2011 at 8:01pm
Did you get anywhere with this?? I want to setup a user to access one page type or a particular page and children when setting up user group it doesn't allow to admin area. I am also confused as to the permissions setup.
| 1069 Views | ||
|
Page:
1
|
Go to Top |



