Browse Source

Fix resources issue

hotfix/merge
Giovanni Colapinto 7 years ago
parent
commit
7fdcc5d22a
  1. 4
      keycloak/authorization/__init__.py

4
keycloak/authorization/__init__.py

@ -75,13 +75,15 @@ class Authorization:
self.policies[policy_name].add_permission(permission) self.policies[policy_name].add_permission(permission)
if pol['type'] == 'resource': if pol['type'] == 'resource':
from pprint import pprint
permission = Permission(name=pol['name'], permission = Permission(name=pol['name'],
type=pol['type'], type=pol['type'],
logic=pol['logic'], logic=pol['logic'],
decision_strategy=pol['decisionStrategy']) decision_strategy=pol['decisionStrategy'])
permission.resources = ast.literal_eval(pol['config']['resources'])
permission.resources = ast.literal_eval(pol['config'].get('resources', "[]"))
for policy_name in ast.literal_eval(pol['config']['applyPolicies']): for policy_name in ast.literal_eval(pol['config']['applyPolicies']):
if self.policies.get(policy_name) is not None:
self.policies[policy_name].add_permission(permission) self.policies[policy_name].add_permission(permission)
Loading…
Cancel
Save