switch to PolicyEngine everywhere

This commit is contained in:
Jens Langhammer
2019-02-27 15:49:20 +01:00
parent 2ce6f5a714
commit 5584f5bda8
4 changed files with 13 additions and 16 deletions

View File

@ -73,14 +73,6 @@ class PolicyModel(UUIDModel, CreatedUpdatedModel):
policies = models.ManyToManyField('Policy', blank=True)
def passes(self, user: User) -> Union[bool, Tuple[bool, str]]:
"""Return False, str if a user fails where str is a
reasons shown to the user. Return True if user succeeds."""
for policy in self.policies.all():
if not policy.passes(user):
return False
return True
class Factor(PolicyModel):
"""Authentication factor, multiple instances of the same Factor can be used"""