4

For instance, say I have the role "category manager" and the role "product manager", but then there are some users which need to have access to both categories and products. Ideally, I would like to be able to say that user X has the permissions from both roles, rather than having to create a third "category and product manager" role.

In the backend, assigning a user to a role is done by a radio button, which seems to imply that a user can only have one role. But, the role management backend allows me to select any users to add to the role, and I don't see anything to say that adding a user to the role will remove the user from their current role.

So, can users be added to more than one role?

If it is not possible through the backend, can I assign users to more than one role via the database? i.e. if I add to the database links connecting a user to more than one row, will it apply all of the permissions, or will it only use one of them?

1 Answer 1

2

TL;DR: no it is not possible to assign more than one role

The database tables admin_* look like this is possible. There are rules in admin_rule, users in admin_users and a tree in admin_role

|-- Administrator (role name)
|     |-- John Doe (user)
|     +-- Martha Example (user)
+-- CMS Manager (role name)
      |-- user 3
      +-- user 4

So theoretically it should be possible to save users at two locations in this tree.

But the implementation in Mage_Admin_Model_User let me think this is not possible:

/**
 * Get admin role model
 *
 * @return Mage_Admin_Model_Roles
 */
public function getRole()
{
    if (null === $this->_role) {
        $this->_role = Mage::getModel('admin/roles');
        $roles = $this->getRoles();
        if ($roles && isset($roles[0]) && $roles[0]) {
            $this->_role->load($roles[0]);
        }
    }
    return $this->_role;
}

But I didn't dig into the ACL loading implementation. Maybe I'm wrong. The easiest is to just add an entry into admin_role by hand and then try it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.