Преглед изворни кода

HUE-8758 [connectors] Hide ensure home directory creation input for now

Only SQL connectors are currently supported
Romain пре 5 година
родитељ
комит
adf6b00111

+ 6 - 3
apps/useradmin/src/useradmin/forms.py

@@ -79,8 +79,7 @@ def validate_last_name(last_name):
 
 class UserChangeForm(django.contrib.auth.forms.UserChangeForm):
   """
-  This is similar, but not quite the same as djagno.contrib.auth.forms.UserChangeForm
-  and UserCreationForm.
+  This is similar, but not quite the same as djagno.contrib.auth.forms.UserChangeForm and UserCreationForm.
   """
 
   GENERIC_VALIDATION_ERROR = _("Username or password is invalid.")
@@ -105,7 +104,11 @@ class UserChangeForm(django.contrib.auth.forms.UserChangeForm):
       required=False,
       validators=hue_get_password_validators()
   )
-  password_old = forms.CharField(label=_t("Current password"), widget=forms.PasswordInput, required=False)
+  password_old = forms.CharField(
+      label=_t("Current password"),
+      widget=forms.PasswordInput,
+      required=False
+  )
   ensure_home_directory = forms.BooleanField(
       label=_t("Create home directory"),
       help_text=_t("Create home directory if one doesn't already exist."),

+ 6 - 2
apps/useradmin/src/useradmin/templates/edit_user.mako

@@ -17,7 +17,7 @@
 from django.utils.translation import ugettext as _
 
 from desktop.auth.backend import is_admin
-from desktop.conf import ENABLE_ORGANIZATIONS
+from desktop.conf import ENABLE_ORGANIZATIONS, ENABLE_CONNECTORS
 from desktop.views import commonheader, commonfooter
 
 from useradmin.hue_password_policy import is_password_policy_enabled, get_password_hint
@@ -81,8 +81,12 @@ ${ layout.menubar(section='users') }
           % endif
           ${layout.render_field(form["password2"], extra_attrs=username is None and {'validate':'true'} or {})}
         % endif
-        ${layout.render_field(form["ensure_home_directory"])}
+
+        % if ENABLE_CONNECTORS.get():
+          ${ layout.render_field(form["ensure_home_directory"]) }
+        % endif
         </div>
+
         <div id="step2" class="stepDetails hide">
           % if "first_name" in form.fields:
             ${layout.render_field(form["first_name"])}

+ 4 - 2
apps/useradmin/src/useradmin/views.py

@@ -1007,8 +1007,10 @@ def _import_ldap_users_info(connection, user_info, sync_groups=False, import_by_
           # Add only if user isn't part of group.
             current_ldap_groups.add(Group.objects.get(name=group_info['name']))
             if not user.groups.filter(name=group_info['name']).exists():
-              groups = import_ldap_groups(connection, group_info['dn'], import_members=False, import_members_recursive=False,
-                                          sync_users=True, import_by_dn=True, failed_users=failed_users)
+              groups = import_ldap_groups(
+                  connection, group_info['dn'], import_members=False, import_members_recursive=False,
+                  sync_users=True, import_by_dn=True, failed_users=failed_users
+              )
               if groups:
                 new_groups.update(groups)
         # Remove out of date groups