Commit 374c2f34 authored by Tross Yvormes's avatar Tross Yvormes

Add AnyGroupMembershipVerifier and TESTAlliesMembershipVerifier

parent ee381efb
......@@ -16,12 +16,27 @@ class GroupMembershipVerifier(Verifier):
def valid(self, groups, **kwargs):
for g in groups:
if g['id'] == self.group:
if g["id"] == self.group:
return True
return False
class AnyGroupMembershipVerifier(Verifier):
message = "You are not in the correct groups to log in to this site."
def valid(self, groups, **kwargs):
return any([g["id"] in self.groups for g in groups])
class TESTMembershipVerifier(GroupMembershipVerifier):
message = "You are not in TEST so you are not allowed to log in."
group = 6
class TESTAlliesMembershipVerifier(AnyGroupMembershipVerifier):
message = (
"You are not in TEST or an ally of TEST so you are not allowed to "
"log in."
)
groups = [6, 26]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment