From 88b5537df45476de7c52997ff39731e7f0cfc81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 30 Aug 2016 14:18:27 +0200 Subject: [PATCH] Avoid crash when there is no current user --- pillar/api/utils/authorization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pillar/api/utils/authorization.py b/pillar/api/utils/authorization.py index 2b64fc4c..4ae160c1 100644 --- a/pillar/api/utils/authorization.py +++ b/pillar/api/utils/authorization.py @@ -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. allowed_methods = set() - current_user = g.current_user + current_user = getattr(g, 'current_user', None) if current_user: # If the user is authenticated, proceed to compare the group permissions for permission in computed_permissions.get('groups', ()):