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_user_management_roles(self): from kotti.security import USER_MANAGEMENT_ROLES from kotti.security import set_user_management_roles from kotti.security import reset_user_management_roles before = USER_MANAGEMENT_ROLES[:] set_user_management_roles(["role:admin"]) assert USER_MANAGEMENT_ROLES == ["role:admin"] reset_user_management_roles() assert USER_MANAGEMENT_ROLES == before
def test_set_user_management_roles(self): from kotti.security import USER_MANAGEMENT_ROLES from kotti.security import set_user_management_roles from kotti.security import reset_user_management_roles before = USER_MANAGEMENT_ROLES[:] set_user_management_roles(['role:admin']) assert USER_MANAGEMENT_ROLES == ['role:admin'] reset_user_management_roles() assert USER_MANAGEMENT_ROLES == before