Theme Permissions
Permalink
Is it possible to allow access to different themes for one users, and a separate set of themes for another user?
Using the Domain Mapping Addon I am attempting to setup a service that allows for the creation of Landing Pages. So far everything is working perfect except that I cannot find a way to restrict what Themes a user can access.
Thanks.
Using the Domain Mapping Addon I am attempting to setup a service that allows for the creation of Landing Pages. So far everything is working perfect except that I cannot find a way to restrict what Themes a user can access.
Thanks.
I was afraid of that.
bummer :(
bummer :(
How do I allow Edit, Versions, and Properties access but nothing else. Like no Design or Permissions buttons.
EDIT: Never mind I found it. Just removed the Admin check from the their permissions.
EDIT: Never mind I found it. Just removed the Admin check from the their permissions.
Dashboard -> sitewide settings -> access -> other permissions.
There you can check and uncheck what people are allowed to do.
Best way to do this is create a user account and test the impact of your changes to be sure they are what you want.
There you can check and uncheck what people are allowed to do.
Best way to do this is create a user account and test the impact of your changes to be sure they are what you want.
Thanks but the permissions available in the Other Permissions page don't include the level of access I was referring to. Using Advanced Permissions model I found the setting I needed on a per page/per user level.
restricting access to themes based on a whitelist in form of a user_attribute can be done quite easily.
1. Create an user_attribute available_themes it's a multi select dropdown.
2. enable advanced permissions to restrict page_types User-/Groupbased or generally
3. copy the concrete/elements/collection_theme.php to elements/collection_theme.php
4. In line 142 and following you need to wrap the themes list into a conditional. here's an example:http://pastie.org/1079362
Idk if it's bugfree but this gives you the idea on howto restrict themes on a user basis.
I hope this + a nice Backend interface to add remove available themes from a user's account is soon available.
1. Create an user_attribute available_themes it's a multi select dropdown.
2. enable advanced permissions to restrict page_types User-/Groupbased or generally
3. copy the concrete/elements/collection_theme.php to elements/collection_theme.php
4. In line 142 and following you need to wrap the themes list into a conditional. here's an example:http://pastie.org/1079362
Idk if it's bugfree but this gives you the idea on howto restrict themes on a user basis.
I hope this + a nice Backend interface to add remove available themes from a user's account is soon available.
After a little tweaking I got it to work.
http://pastie.org/1079477
Just replace Lines 142-155 with the above code and it works.
One thing I found odd is that there is anew line character in the Theme name value for some reason. Trim() fixed that though. Not sure if this is the best way to handle it but it works.
Thanks a ton Fernandos for pointing me in the right direction and helping with the code.
http://pastie.org/1079477
Just replace Lines 142-155 with the above code and it works.
One thing I found odd is that there is anew line character in the Theme name value for some reason. Trim() fixed that though. Not sure if this is the best way to handle it but it works.
Thanks a ton Fernandos for pointing me in the right direction and helping with the code.
Ok found a problem when you only have 1 Theme assigned to the user. Seems the getAttribute() method does not return the same object type if only 1 value is selected.
So here is the fix.
http://pastie.org/1079536
So here is the fix.
http://pastie.org/1079536
<?php $u = new User(); Loader::model('user_attributes'); if ($u->isRegistered() && $u->getUserID() != 1) { $u_attrkey = UserAttributeKey::getByHandle('available_themes'); $ui = UserInfo::getByID($u->getUserID()); $u_attr = $ui->getAttribute($u_attrkey); foreach ($u_attr as $available_theme) { $at[$available_theme->ID] = $available_theme->value; } if(count($at)==1){ unset($at); $at[$u_attr->ID] = $u_attr->value; } foreach ($tArray as $t) {
Viewing 15 lines of 29 lines. View entire code block.
You can either allow them to assign themes or disallow them to access the themes.