Programmatically set Block type permissions
Permalink
Hey everyone of you c5 devoted web developers! I need your help.
Is there a relatively simple and clean way to set what "block types" are available to the users (while in edit mode...obviously xD) based on a specific page type?
I've tried setting them up directly through "page type" :: defaults interface, which seems to be the right procedure, but when testing, users with write permissions, are still entitled to add all the installed blocks/packages.
Thanks in advance for any and all help!!
Is there a relatively simple and clean way to set what "block types" are available to the users (while in edit mode...obviously xD) based on a specific page type?
I've tried setting them up directly through "page type" :: defaults interface, which seems to be the right procedure, but when testing, users with write permissions, are still entitled to add all the installed blocks/packages.
Thanks in advance for any and all help!!
Cheers synlag. I've already taken a look at that and it isn't quite what I'm looking for.
Permissions class allows me to check whether a user/group has the ability to perform a specific task. not sure if it allows me to set permissions. i've studied the class but never really got the full grasp of it's potential.
I need to know how to set what block types are available to add as blocks for a specific page type and not only for a one page. Don't want users having the ability to add all and every block/package installed in the system.
Thanks for your response mate
Permissions class allows me to check whether a user/group has the ability to perform a specific task. not sure if it allows me to set permissions. i've studied the class but never really got the full grasp of it's potential.
I need to know how to set what block types are available to add as blocks for a specific page type and not only for a one page. Don't want users having the ability to add all and every block/package installed in the system.
Thanks for your response mate
I am also looking into this. It's had me stumped for about a week!
I'm currently giving a user a page they can edit.
I'm setting them as the owner.
I'm giving them read,write,etc with:
There's the Permissions model also. I can get the object that has all of the permissions for an area and this includes the addBlockTypes like this:
My big question is. How do you reapply area permissions?
Is there another method for setting area permissions?
I'm currently giving a user a page they can edit.
I'm setting them as the owner.
I'm giving them read,write,etc with:
$pt = CollectionType::getByHandle("page_member_profile"); $newPage = $parentPage->add($pt,$data); $permissionsConfig = new stdClass; $permissionsConfig->user[0]['uID'] = $u->getUserID(); $permissionsConfig->user[0]['canRead'] = 1; $permissionsConfig->user[0]['canWrite'] = 1; $permissionsConfig->user[0]['canApproveVersions'] = true; $permissionsConfig->user[0]['canDelete'] = false; $permissionsConfig->user[0]['canAdmin'] = false; //these don't work $permissionsConfig->user[0]['Main']['canWrite'] = true; $permissionsConfig->user[0]['Sidebar']['canWrite'] = true; $permissionsConfig->user[0]['nav']['canWrite'] = false; $permissionsConfig->user[0]['header']['canWrite'] = false; $permissionsConfig->user[0]['footer']['canWrite'] = false;
Viewing 15 lines of 16 lines. View entire code block.
There's the Permissions model also. I can get the object that has all of the permissions for an area and this includes the addBlockTypes like this:
$aa = Area::get($newPage, 'Main'); $pp = new Permissions($aa); $cap = array(2,4,20); // block type IDs I think... $pp->addBlockTypes = $cap; //this fails.. $ps = $this->loadPermissionSet($pp);
My big question is. How do you reapply area permissions?
Is there another method for setting area permissions?
this should help you
http://www.concrete5.org/documentation/developers/permissions/conte...