This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hard-code an HR auth group for Team Gratipay(!)
- Loading branch information
1 parent
a8901bf
commit 8335b3b
Showing
2 changed files
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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') | ||
|
||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/') | ||
|