Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Hard-code an HR auth group for Team Gratipay(!)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed May 12, 2016
1 parent a8901bf commit 8335b3b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/py/test_identity_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class Tests(Harness):

def setUp(self):
self.make_participant('alice', claimed_time='now', is_admin=True)
self.make_participant('whit537', id=1451, email_address='[email protected]',
claimed_time='now', is_admin=True)
self.make_participant('bob', claimed_time='now', email_address='[email protected]')
self.verify('bob', 'TT')

Expand Down Expand Up @@ -52,8 +54,11 @@ def test_ip_is_403_for_non_admin(self):
def test_ip_is_200_for_self(self):
assert self.client.GET('/~bob/identities/TT', auth_as='bob').code == 200

def test_ip_is_200_for_admin(self):
assert self.client.GET('/~bob/identities/TT', auth_as='alice').code == 200
def test_ip_is_403_for_most_admins(self):
assert self.client.GxT('/~bob/identities/TT', auth_as='alice').code == 403

def test_ip_is_200_for_whit537_yikes(self):
assert self.client.GET('/~bob/identities/TT', auth_as='whit537').code == 200

def test_ip_is_404_for_unknown_code(self):
assert self.client.GxT('/~bob/identities/XX', auth_as='bob').code == 404
Expand Down
7 changes: 7 additions & 0 deletions www/~/%username/identities/%country.spt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ from gratipay.models.country import Country
[---]
participant = get_participant(state, restrict=True)

# hard-code HR auth group for Team Gratipay O.O
if participant != user.participant:
w = user.participant
assert user.ADMIN, w.username # sanity check
if (w.id, w.username, w.email_address) != (1451, 'whit537', '[email protected]'):
raise Response(403)

# require email
if not participant.email_address:
website.redirect('/about/me/emails/')
Expand Down

0 comments on commit 8335b3b

Please sign in to comment.