From b5e19043f57b741d4d1a539557005ff705eb8258 Mon Sep 17 00:00:00 2001 From: Raspreet Singh Date: Mon, 15 May 2023 15:11:06 +0530 Subject: [PATCH] fix: Fixes `Authorization.load_config` breaking if a scope based permission is linked with anything other than a role based policy. Fixes #445 (#446) --- src/keycloak/authorization/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/keycloak/authorization/__init__.py b/src/keycloak/authorization/__init__.py index e000841..ddb885c 100644 --- a/src/keycloak/authorization/__init__.py +++ b/src/keycloak/authorization/__init__.py @@ -88,7 +88,8 @@ class Authorization: if "applyPolicies" in pol["config"]: for policy_name in ast.literal_eval(pol["config"]["applyPolicies"]): - self.policies[policy_name].add_permission(permission) + if self.policies.get(policy_name) is not None: + self.policies[policy_name].add_permission(permission) if pol["type"] == "resource": permission = Permission(