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.

ideasponge
 
Brainakazariua replied on at Permalink Reply
Brainakazariua
it is not possible to assign specific rights to a specific theme.

You can either allow them to assign themes or disallow them to access the themes.
ideasponge replied on at Permalink Reply
ideasponge
I was afraid of that.

bummer :(
ideasponge replied on at Permalink Reply
ideasponge
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.
Brainakazariua replied on at Permalink Reply
Brainakazariua
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.
ideasponge replied on at Permalink Reply
ideasponge
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.
Fernandos replied on at Permalink Best Answer Reply
Fernandos
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.
ideasponge replied on at Permalink Reply
ideasponge
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.
ideasponge replied on at Permalink Reply
ideasponge
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

<?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) {