+ raise EngineException(
+ "Invalid configuration param '{}' at '[message]':'driver'".format(
+ config["message"]["driver"]
+ )
+ )
+ if not self.authconn:
+ if config["authentication"]["backend"] == "keystone":
+ self.authconn = AuthconnKeystone(
+ config["authentication"],
+ self.db,
+ self.authenticator.role_permissions,
+ )
+ elif config["authentication"]["backend"] == "tacacs":
+ self.authconn = AuthconnTacacs(
+ config["authentication"],
+ self.db,
+ self.authenticator.role_permissions,
+ )
+ else:
+ self.authconn = AuthconnInternal(
+ config["authentication"],
+ self.db,
+ self.authenticator.role_permissions,
+ )
+ # if not self.operations:
+ # if "resources_to_operations" in config["rbac"]:
+ # resources_to_operations_file = config["rbac"]["resources_to_operations"]
+ # else:
+ # possible_paths = (
+ # __file__[:__file__.rfind("engine.py")] + "resources_to_operations.yml",
+ # "./resources_to_operations.yml"
+ # )
+ # for config_file in possible_paths:
+ # if path.isfile(config_file):
+ # resources_to_operations_file = config_file
+ # break
+ # if not resources_to_operations_file:
+ # raise EngineException("Invalid permission configuration:"
+ # "resources_to_operations file missing")
+ #
+ # with open(resources_to_operations_file, 'r') as f:
+ # resources_to_operations = yaml.safeload(f)
+ #
+ # self.operations = []
+ #
+ # for _, value in resources_to_operations["resources_to_operations"].items():
+ # if value not in self.operations:
+ # self.operations += [value]