Browse Source

HUE-8530 [organization] Add the notion of organization admin

Romain 5 năm trước cách đây
mục cha
commit
30abb5aab7

+ 2 - 1
apps/useradmin/src/useradmin/models2.py

@@ -21,6 +21,8 @@ import uuid
 from django.contrib.auth.models import models, AbstractUser, BaseUserManager
 from django.utils.translation import ugettext_lazy as _t
 
+from desktop.models import uuid_default
+
 
 LOG = logging.getLogger(__name__)
 
@@ -124,7 +126,6 @@ class OrganizationUser(AbstractUser):
     username = None
     email = models.EmailField(_t('Email address'), unique=True)
     token = models.CharField(_t('Token'), max_length=128, default=None, null=True)
-    customer_id = models.CharField(_t('Customer id'), max_length=128, default=None, null=True) # Needed?
     organization = models.ForeignKey(Organization, on_delete=models.CASCADE)
     is_admin = models.BooleanField(default=False)
 

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

@@ -106,7 +106,7 @@ def is_admin(user):
   is_admin = False
   if hasattr(user, 'is_superuser'):
     is_admin = user.is_superuser
-  if not is_admin and user.is_authenticated() and not ENABLE_ORGANIZATIONS.get():  # Admin group activated only in organization mode.
+  if not is_admin and user.is_authenticated() and not ENABLE_ORGANIZATIONS.get():  # Admin group only within an organization if later is enabled
     try:
       user = rewrite_user(user)
       is_admin = user.has_hue_permission(action="superuser", app="useradmin")