Skip to content

Commit

Permalink
Allow both principal and anchor in roles_for (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Feb 5, 2018
1 parent 54f5e44 commit b1bde5a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
3 changes: 0 additions & 3 deletions coaster/sqlalchemy/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,6 @@ def roles_for(self, principal=None, anchor=None):
specified, the role ``principal`` is granted. If not, ``anon`` is
granted.
"""
if principal is not None and anchor is not None:
raise TypeError('Either principal or anchor must be specified, not both')

if principal is None:
result = {'all', 'anon'}
else:
Expand Down
6 changes: 0 additions & 6 deletions tests/test_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,6 @@ def test_bad_decorator(self):
def foo():
pass

def test_roles_for_principal_and_anchor(self):
"""roles_for accepts principal or anchor, not both"""
rm = RoleModel(name=u'test', title=u'Test')
with self.assertRaises(TypeError):
rm.roles_for(principal=1, anchor='owner-secret')

def test_access_for_roles_and_principal_or_anchor(self):
"""access_for accepts roles or principal/anchor, not both/all"""
rm = RoleModel(name=u'test', title=u'Test')
Expand Down

0 comments on commit b1bde5a

Please sign in to comment.