Commit d435bfc2 by Őry Máté

acl: has_level: return early for anonymous

parent d474f100
...@@ -132,6 +132,8 @@ class AclBase(Model): ...@@ -132,6 +132,8 @@ class AclBase(Model):
def has_level(self, user, level, group_also=True): def has_level(self, user, level, group_also=True):
logger.debug('%s.has_level(%s, %s, %s) called', logger.debug('%s.has_level(%s, %s, %s) called',
*[unicode(p) for p in [self, user, level, group_also]]) *[unicode(p) for p in [self, user, level, group_also]])
if user is None or not user.is_authenticated():
return False
if getattr(user, 'is_superuser', False): if getattr(user, 'is_superuser', False):
logger.debug('- superuser granted') logger.debug('- superuser granted')
return True return True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment