pass
except ValueError:
pass
- self.db.set_one("users", {BaseTopic.id_field("users", uid): uid}, user_data) # CONFIRM
+ idf = BaseTopic.id_field("users", uid)
+ self.db.set_one("users", {idf: uid}, user_data)
+ if user_info.get("remove_project_role_mappings"):
+ self.db.del_list("tokens", {"user_id" if idf == "_id" else idf: uid})
+ self.token_cache.clear()
def delete_user(self, user_id):
"""
:raises AuthconnOperationException: if user deletion failed.
"""
self.db.del_one("users", {"_id": user_id})
+ self.db.del_list("tokens", {"user_id": user_id})
+ self.token_cache.clear()
return True
def get_user_list(self, filter_q=None):
# Add new versions here
}
- def __init__(self):
+ def __init__(self, token_cache):
self.db = None
self.fs = None
self.msg = None
self.logger = logging.getLogger("nbi.engine")
self.map_topic = {}
self.write_lock = None
+ self.token_cache = token_cache
def start(self, config):
"""
if config["authentication"]["backend"] == "keystone":
self.auth = AuthconnKeystone(config["authentication"], self.db, None)
else:
- self.auth = AuthconnInternal(config["authentication"], self.db, dict())
+ self.auth = AuthconnInternal(config["authentication"], self.db, self.token_cache)
if not self.operations:
if "resources_to_operations" in config["rbac"]:
resources_to_operations_file = config["rbac"]["resources_to_operations"]
def __init__(self):
self.instance += 1
- self.engine = Engine()
self.authenticator = Authenticator(valid_url_methods, valid_query_string)
+ self.engine = Engine(self.authenticator.tokens_cache)
def _format_in(self, kwargs):
try: