Ver Fonte

HUE-8530 [organization] Do not try to monkeypatch the User username

As it does not exist and was replaced by email.
Romain há 5 anos atrás
pai
commit
f8d9c69fab

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

@@ -69,8 +69,7 @@ else:
   def default_organization(): pass
   def get_organization(): pass
 
-
-monkey_patch_username_validator()
+  monkey_patch_username_validator()
 
 
 LOG = logging.getLogger(__name__)

+ 5 - 3
apps/useradmin/src/useradmin/models2.py

@@ -21,7 +21,6 @@ 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__)
@@ -39,6 +38,9 @@ def get_organization(user):
   # TODO: depends on the logged-in user and its organization
   return default_organization()
 
+def uuid_default():
+  return str(uuid.uuid4())
+
 
 def uuid_default():
   return str(uuid.uuid4())
@@ -55,6 +57,7 @@ class Organization(models.Model):
   name = models.CharField(max_length=200, help_text=_t("The name of the organization"), unique=True)
   uuid = models.CharField(default=uuid_default, max_length=36, unique=True)
   domain = models.CharField(max_length=200, help_text=_t("The domain name of the organization, e.g. gethue.com"), unique=True)
+  customer_id = models.CharField(_t('Customer id'), max_length=128, default=None, null=True)
   is_active = models.BooleanField(default=True)
   is_multi_user = models.BooleanField(default=True)
 
@@ -143,8 +146,7 @@ class OrganizationUser(AbstractUser):
       verbose_name=_t('groups'),
       blank=True,
       help_text=_t(
-          'The groups this user belongs to. A user will get all permissions '
-          'granted to each of their groups.'
+          'The groups this user belongs to. A user will get all permissions granted to each of their groups.'
       ),
       related_name="user_set",
       related_query_name="user",

+ 0 - 1
desktop/core/src/desktop/models.py

@@ -58,7 +58,6 @@ from desktop.redaction import global_redaction_engine
 from desktop.settings import DOCUMENT2_SEARCH_MAX_LENGTH, HUE_DESKTOP_VERSION
 
 if sys.version_info[0] > 2:
-  import urllib.request, urllib.error
   from urllib.parse import quote as urllib_quote
 else:
   from urllib import quote as urllib_quote