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'])
def test_set_sharing_roles(self): from kotti.security import SHARING_ROLES from kotti.security import set_sharing_roles from kotti.security import reset_sharing_roles before = SHARING_ROLES[:] set_sharing_roles(["role:admin"]) assert SHARING_ROLES == ["role:admin"] reset_sharing_roles() assert SHARING_ROLES == before
def test_set_sharing_roles(self): from kotti.security import SHARING_ROLES from kotti.security import set_sharing_roles from kotti.security import reset_sharing_roles before = SHARING_ROLES[:] set_sharing_roles(['role:admin']) assert SHARING_ROLES == ['role:admin'] reset_sharing_roles() assert SHARING_ROLES == before