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_roles(self): from kotti.security import ROLES from kotti.security import set_roles from kotti.security import reset_roles before = ROLES.copy() set_roles({"role:admin": ROLES["role:admin"]}) assert ROLES == {"role:admin": ROLES["role:admin"]} reset_roles() assert ROLES == before
def test_set_roles(self): from kotti.security import ROLES from kotti.security import set_roles from kotti.security import reset_roles before = ROLES.copy() set_roles({'role:admin': ROLES['role:admin']}) assert ROLES == {'role:admin': ROLES['role:admin']} reset_roles() assert ROLES == before