Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: remove duplicated check #117

Merged
merged 2 commits into from
Feb 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions casbin/model/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ def add_policies(self,sec,ptype,rules):
def remove_policy(self, sec, ptype, rule):
"""removes a policy rule from the model."""

if sec not in self.model.keys():
return False
if ptype not in self.model[sec]:
return False

Zxilly marked this conversation as resolved.
Show resolved Hide resolved
if not self.has_policy(sec, ptype, rule):
return False

Expand All @@ -106,11 +101,6 @@ def remove_policy(self, sec, ptype, rule):
def remove_policies(self, sec, ptype, rules):
"""RemovePolicies removes policy rules from the model."""

if sec not in self.model.keys():
return False
if ptype not in self.model[sec]:
return False

for rule in rules:
if not self.has_policy(sec,ptype,rule):
return False
Expand Down