瀏覽代碼

HUE-9024 [core] Prevent AnonymousUser object is not iterable on login

Romain 6 年之前
父節點
當前提交
c320069bee
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      desktop/core/src/desktop/auth/backend.py

+ 1 - 2
desktop/core/src/desktop/auth/backend.py

@@ -101,13 +101,12 @@ def is_admin(user):
   is_admin = False
   if hasattr(user, 'is_superuser'):
     is_admin = user.is_superuser
-  if not is_admin:
+  if not is_admin and user.is_authenticated():
     try:
       user = rewrite_user(user)
       is_admin = user.has_hue_permission(action="superuser", app="useradmin")
     except Exception as e:
       LOG.exception("Could not validate if %s is a superuser assuming False." % user)
-      is_admin = False
   return is_admin
 
 class DefaultUserAugmentor(object):