projects
/
osm
/
NBI.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Throwing error when old format is used with Keystone
[osm/NBI.git]
/
osm_nbi
/
admin_topics.py
diff --git
a/osm_nbi/admin_topics.py
b/osm_nbi/admin_topics.py
index
07f18da
..
31937f9
100644
(file)
--- a/
osm_nbi/admin_topics.py
+++ b/
osm_nbi/admin_topics.py
@@
-84,6
+84,13
@@
class UserTopic(BaseTopic):
content["_admin"]["salt"] = salt
if content.get("password"):
content["password"] = sha256(content["password"].encode('utf-8') + salt.encode('utf-8')).hexdigest()
content["_admin"]["salt"] = salt
if content.get("password"):
content["password"] = sha256(content["password"].encode('utf-8') + salt.encode('utf-8')).hexdigest()
+ if content.get("project_role_mappings"):
+ projects = [mapping[0] for mapping in content["project_role_mappings"]]
+
+ if content.get("projects"):
+ content["projects"] += projects
+ else:
+ content["projects"] = projects
@staticmethod
def format_on_edit(final_content, edit_content):
@staticmethod
def format_on_edit(final_content, edit_content):
@@
-387,6
+394,10
@@
class UserTopicAuth(UserTopic):
username = indata.get("username")
user_list = list(map(lambda x: x["username"], self.auth.get_user_list()))
username = indata.get("username")
user_list = list(map(lambda x: x["username"], self.auth.get_user_list()))
+ if "projects" in indata.keys():
+ raise EngineException("Format invalid: the keyword \"projects\" is not allowed for Keystone",
+ HTTPStatus.BAD_REQUEST)
+
if username in user_list:
raise EngineException("username '{}' exists".format(username), HTTPStatus.CONFLICT)
if username in user_list:
raise EngineException("username '{}' exists".format(username), HTTPStatus.CONFLICT)