back/auth: fix access rank lookups
This commit is contained in:
parent
3fd7f64fa3
commit
ff0fe077d4
|
@ -40,15 +40,15 @@ class AuthService(object):
|
||||||
+ ['admin', 'nobody']
|
+ ['admin', 'nobody']
|
||||||
|
|
||||||
assert privilege_name in self._config['privileges']
|
assert privilege_name in self._config['privileges']
|
||||||
assert user.rank in all_ranks
|
assert user.access_rank in all_ranks
|
||||||
minimal_rank = self._config['privileges'][privilege_name]
|
minimal_rank = self._config['privileges'][privilege_name]
|
||||||
good_ranks = all_ranks[all_ranks.index(minimal_rank):]
|
good_ranks = all_ranks[all_ranks.index(minimal_rank):]
|
||||||
if user.rank not in good_ranks:
|
if user.access_rank not in good_ranks:
|
||||||
raise AuthError('Insufficient privileges to do this.')
|
raise AuthError('Insufficient privileges to do this.')
|
||||||
|
|
||||||
def _create_anonymous_user(self):
|
def _create_anonymous_user(self):
|
||||||
user = User()
|
user = User()
|
||||||
user.name = None
|
user.name = None
|
||||||
user.rank = 'anonymous'
|
user.access_rank = 'anonymous'
|
||||||
user.password = None
|
user.password = None
|
||||||
return user
|
return user
|
||||||
|
|
Loading…
Reference in New Issue