Jump to content

Batch allow template edit access to new role


onjegolders
 Share

Recommended Posts

Is there a way to quickly allow a new role, say "editor", to have edit access on all templates and then go and perhaps remove it on a case by case basis?

This would be a lot quicker in certain situations than having to do the opposite and open each template separately, click manage access and tick the box.

If not, perhaps in the API?

Link to comment
Share on other sites

There's no option for that.

Sure API sounds good. A quick glance at ProcessTemplate.module shows how it's done. With this code in a template and call it once.

$tmpl = $templates->get("basic-page");
$editor_role = $roles->get("editor");
$editRoles = $tmpl->get("editRoles"); // currently set roles
$value = array();

// assign already set roles
foreach($editRoles as $v) $value[(int)$v] = (int)$v;
// add new role to it
$value[(int)$editor_role->id] = (int)$editor_role->id;

// set editRoles property and save
$tmpl->set("editRoles",$value);
$tmpl->save();
  • Like 2
Link to comment
Share on other sites

Thanks Soma for this, it's something I may look at soon. I'm more worried about if I had a site with loads and loads of templates, it just seems a bit unintuitive to have to go through each template manually.

Maybe it could be considered for the roadmap. Perhaps on the role page you could have a list of checkboxes so that you could tick next to each template for edit, create, children etc. There's a lot of wasted clicks currently.

Link to comment
Share on other sites

What is probably needed is a permissions map where you can look at all permissions belonging to a group or a single user.

So, you could show permissions for a group for templates - then either change permissions individually or select the entire lot (or multi select some of them) and change the permissions.

Probably hell to programme, but as PW sites get more adventurous and larger, possibly very useful.

  • Like 2
Link to comment
Share on other sites

Funnily enough I was thinking that this would make a good module the other day.

There are instances on larger sites where you are likely to have many templates and not add other user roles til the end, so a permissions matrix would come in handy.

Where I think it would be even more useful is in conjunction with the module that allows you to give per-page access, but every time I think about how that might work I get a major headache. I need to mock up some examples of how this might work.

A template permission matrix is a far easier prospect by comparison.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

And you have forgotten a per-field basis, which is almost the most useful!

I think you have to look at it this way:

Global Scope: This is changing read/write/edit/create/copy/own on everything that is page shaped (and not part of admin only)

So a user can be given global edit rights (via a user role) and they can edit anything.

That is sort of as it is at the moment.

Local Scope (or page tree scope) - this is based on template hierarchy as now where the permissions on a template can be modified by a template higher in the page tree.

Now, we need to break free!

Template Scope - this would be the rights on a template that are exclusive, where-ever they are in the tree. This overrides other settings for that user, but does not affect the hierarchy.

Page Scope - this is also exclusive (and there is a module for this)

Field Scope - this would be either prevent someone from entering data and/or reading it. However, this might be extended to allow different interfaces (this is possibly only for textarea, but might also be for page field.) So, a registered user might get a very limited TinyMCE, but the editor gets the kitchen sink.

Out of these, the first two are the only ones that that need to be managed globally, since the other ones work exclusively. However, as a separate function, it might be nice to list all exclusive permissions belonging to one user group or one user and to be able to either change them in their own grid or change the entire lot for that user or group.

Something like that.

  • Like 1
Link to comment
Share on other sites

In my head, I'm seeing checkboxes and at the bottom a "With Selected" submit button.

So it may be a list of pages, templates, permissions.

The point being a way of performing several identical actions at once.

At the moment there are several (good) modules which perform part of this but I really think something in the core would be best as with other systems (Symphony, Wordpress etc)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...