Forums » Plugins and Added Functionality

Adding greater granularity to user roles

(2 posts)
  • Started 3 months ago by anarchivist
  • Latest reply from KrisKelly
  • This topic is not a support question
  1. 3 months ago # | |

    I've noticed that there's a significant drop in the number of privileges between the "admin" and "contributor" user roles. We'd like to add a role in between, and I'm curious if that's something that can be done by developing a plugin. In particular, we'd like to create a role that would allow users with that role to add, edit, and delete sections of an exhibit created by an admin or super.

  2. 3 months ago # | |

    Yes, you can add new user roles to Omeka via a plugin. There's no official way to do this with the API yet, so it's still a bit tricky. There are some hacks that we have used in other plugins to make this work. Keep in mind that this is going to work differently in our next major release of Omeka.

    Try the following in the 'initialize' hook for your plugin:

    $acl = get_acl();
    
    $acl->addRole(new Zend_Acl_Role('RoleName'));
    
    $acl->allow('RoleName',  'Exhibits', array('edit', 'addSection', 'editSection', 'deleteSection'));

    Then you have to create a user with a role called RoleName, at which point they should be able to edit exhibits, add sections, edit sections and delete sections from exhibits. One problem I foresee is these users won't be able to see the exhibit form unless you give them 'edit' permissions. but in the current system, being able to view the exhibit editing form is the same as being able to edit the exhibit. I hope that helps!

RSS feed for this topic

Reply

You must log in to post.