diff --git a/casbin/model/policy.py b/casbin/model/policy.py index 55f7a68..ab446e3 100644 --- a/casbin/model/policy.py +++ b/casbin/model/policy.py @@ -118,11 +118,12 @@ def add_policy(self, sec, ptype, rule): print(e) if idx > idx_insert: + tmp = assertion.policy[i] assertion.policy[i] = assertion.policy[i - 1] + assertion.policy[i - 1] = tmp else: break - assertion.policy[i] = rule assertion.policy_map[DEFAULT_SEP.join(rule)] = i except Exception as e: