[Zope] How to rename a role...

Dieter Maurer dieter at handshake.de
Wed Oct 8 14:39:21 EDT 2003


Patrick Gelin wrote at 2003-10-6 11:34 +0200:
 > It's seems to me there is no way in ZMI to rename a role I created. Is
 > there a solution (python script, product, ...) to d oit ?

It's not easy:

  *  Roles are maintained in an attribute "__ac_roles__" (a tuple).
     Renaming a role would mean replacing this role by the new
     role name in "__ac_roles__".

     However, this would lead to an inconsistent state, as

  *  The "permission - role" mapping is maintained in attributes
     of the respective objects.
     After you renamed the role you would have to visit
     all objects in the subhierarchy and update the
     "permission-role" mapping.

     The attribute names all start with "_" and end in "_Permission".
     In between is a mangled version of the permission.
     The values of these attributes are either a tuple or list
     of roles. A list means, "acquire" is enabled.

You can find details in the "AccessControl" package, especially in
"Role.py" and "Permission.py".


Dieter



More information about the Zope mailing list