Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
check type of u.permissions, just to be sure
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Dec 16, 2014
1 parent 0564386 commit 1a0e0c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions relengapi/blueprints/tokenauth/test_tokenauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def app_setup(app):
# utility endpoint
@app.route('/test_tokenauth')
def test_route():
assert isinstance(current_user.permissions, set)
return json.dumps({
'id': current_user.get_id(),
'permissions': sorted(str(a) for a in current_user.permissions),
Expand Down
2 changes: 2 additions & 0 deletions relengapi/lib/auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ def _request_loader(request):
for loader in _request_loaders:
u = loader(request)
if u:
if not isinstance(u.permissions, set):
raise TypeError("user permissions must be a set")
return u


Expand Down

0 comments on commit 1a0e0c5

Please sign in to comment.