This blog post is a small recipe: how to add a new role in user management views and sharing views for local roles management.
It is quite easy, it requires few lines of code you can add to your __init__.py module:
from kotti.security import ( Principal, ROLES, SHARING_ROLES, set_roles, set_sharing_roles, set_user_management_roles, ) from kotti_yourpackage import _ def add_role(role_id, role_title): """ Add role in share view and user management views """ UPDATED_ROLES = ROLES.copy() UPDATED_ROLES[role_id] = Principal(role_id, title=role_title) UPDATED_SHARING_ROLES = list(SHARING_ROLES) UPDATED_SHARING_ROLES.append(role_id) set_roles(UPDATED_ROLES) set_sharing_roles(UPDATED_SHARING_ROLES) set_user_management_roles(UPDATED_SHARING_ROLES + ['role:admin']) add_role(u'role:customer', _(u'Customer'))
And now, we have a new Customer role ready to be used:
As you can see there is a new (pretend) "Customer" role |
After that you can work with ACLs or, better, configure what the customer role can do writing a custom workflow (see http://davidemoro.blogspot.com/2015/02/kotti-cms-workflow-reference.html).