Skip to content

Commit

Permalink
Add a method for checking evaluating authorization.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Dec 13, 2013
1 parent 95b9c69 commit c52b458
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tahrir_api/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ def __json__(self):
tags=self.tags,
)

def authorized(self, person):
""" Return true if a given person is authorized to admin a badge """
for authz in self.authorizations:
for authorized in authz.persons:
if authorized == person:
return True

return False


class Person(DeclarativeBase):
__tablename__ = 'persons'
Expand Down

0 comments on commit c52b458

Please sign in to comment.