projects
/
osm
/
NBI.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bug 713
[osm/NBI.git]
/
osm_nbi
/
auth.py
diff --git
a/osm_nbi/auth.py
b/osm_nbi/auth.py
index
dda1d22
..
bb65738
100644
(file)
--- a/
osm_nbi/auth.py
+++ b/
osm_nbi/auth.py
@@
-231,7
+231,12
@@
class Authenticator:
if self.config["authentication"]["backend"] != "internal" and \
role_with_operations["role"] != "anonymous":
if self.config["authentication"]["backend"] != "internal" and \
role_with_operations["role"] != "anonymous":
- keystone_id = self.backend.create_role(role_with_operations["role"])
+ keystone_id = [role for role in self.backend.get_role_list()
+ if role["name"] == role_with_operations["role"]]
+ if keystone_id:
+ keystone_id = keystone_id[0]
+ else:
+ keystone_id = self.backend.create_role(role_with_operations["role"])
operation_to_roles_item["_id"] = keystone_id["_id"]
self.db.create("roles_operations", operation_to_roles_item)
operation_to_roles_item["_id"] = keystone_id["_id"]
self.db.create("roles_operations", operation_to_roles_item)