Avoid crash when there is no current user

This commit is contained in:
2016-08-30 14:18:27 +02:00
parent 88dd574797
commit 88b5537df4

View File

@@ -62,7 +62,7 @@ def compute_allowed_methods(collection_name, resource, check_node_type=None):
# Accumulate allowed methods from the user, group and world level. # Accumulate allowed methods from the user, group and world level.
allowed_methods = set() allowed_methods = set()
current_user = g.current_user current_user = getattr(g, 'current_user', None)
if current_user: if current_user:
# If the user is authenticated, proceed to compare the group permissions # If the user is authenticated, proceed to compare the group permissions
for permission in computed_permissions.get('groups', ()): for permission in computed_permissions.get('groups', ()):