Skip to content

Commit 6aebadf

Browse files
authored
perf: remove duplicated check (#117)
* perf: remove duplicated check Signed-off-by: Zxilly <zhouxinyu1001@gmail.com> * perf: remove duplicated check Signed-off-by: Zxilly <zhouxinyu1001@gmail.com>
1 parent be9ab9c commit 6aebadf

1 file changed

Lines changed: 0 additions & 10 deletions

File tree

casbin/model/policy.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ def add_policies(self,sec,ptype,rules):
9191
def remove_policy(self, sec, ptype, rule):
9292
"""removes a policy rule from the model."""
9393

94-
if sec not in self.model.keys():
95-
return False
96-
if ptype not in self.model[sec]:
97-
return False
98-
9994
if not self.has_policy(sec, ptype, rule):
10095
return False
10196

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

109-
if sec not in self.model.keys():
110-
return False
111-
if ptype not in self.model[sec]:
112-
return False
113-
114104
for rule in rules:
115105
if not self.has_policy(sec,ptype,rule):
116106
return False

0 commit comments

Comments
 (0)