X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=osm_nbi%2Fadmin_topics.py;h=90c5d088f5fec8e2b8c12427c1130dd6565ecddc;hb=ad682a52ef94fa2662e2a0f6e3f81fb7c8f5e0fe;hp=7a7ace668854a26b155dcfdb431a0b185ec9ee50;hpb=9fe58b17a7d58efbf87df1ae119907b9071ecf2f;p=osm%2FNBI.git diff --git a/osm_nbi/admin_topics.py b/osm_nbi/admin_topics.py index 7a7ace6..90c5d08 100644 --- a/osm_nbi/admin_topics.py +++ b/osm_nbi/admin_topics.py @@ -1107,11 +1107,12 @@ class RoleTopicAuth(BaseTopic): raise EngineException("You cannot delete role '{}'".format(role["name"]), http_code=HTTPStatus.FORBIDDEN) # If any user is using this role, raise CONFLICT exception - for user in self.auth.get_user_list(): - for prm in user.get("project_role_mappings"): - if prm["role"] == _id: - raise EngineException("Role '{}' ({}) is being used by user '{}'" - .format(role["name"], _id, user["username"]), HTTPStatus.CONFLICT) + if not session["force"]: + for user in self.auth.get_user_list(): + for prm in user.get("project_role_mappings"): + if prm["role"] == _id: + raise EngineException("Role '{}' ({}) is being used by user '{}'" + .format(role["name"], _id, user["username"]), HTTPStatus.CONFLICT) @staticmethod def format_on_new(content, project_id=None, make_public=False): # TO BE REMOVED ?