diff --git a/pym/unix/unix.py b/pym/unix/unix.py index 91fa70d..23b84fa 100644 --- a/pym/unix/unix.py +++ b/pym/unix/unix.py @@ -373,7 +373,7 @@ class UnixUsers(object): return flag == "1" def modify_user(self, username, pw=None, gid=None, shell=None, visible=None, - lock=None, comment=None): + lock=None, comment=None, homedir=None): attributes = [] if pw is not None: attributes.append((ldap.MOD_REPLACE, 'userPassword', str(pw))) @@ -383,6 +383,8 @@ class UnixUsers(object): attributes.append((ldap.MOD_REPLACE, 'loginShell', shell)) if comment is not None: attributes.append((ldap.MOD_REPLACE, 'cn', comment)) + if homedir is not None: + attributes.append((ldap.MOD_REPLACE, 'homeDirectory', homedir)) if visible is not None: attributes.append( (ldap.MOD_REPLACE, 'shadowFlag', @@ -556,7 +558,7 @@ class Unix(Ldap): return True def modify_user(self, login, pw, pw_delete, gid, shell, visible, lock, - comment): + comment,homedir): """" Изменить параметры пользователя в LDAP """ @@ -574,6 +576,10 @@ class Unix(Ldap): params['comment'] = comment self.printSUCCESS( _("Changed comment for user %s") % user.username) + if homedir is not None and user.homedir != homedir: + params['homedir'] = homedir + self.printSUCCESS( + _("Changed home directory for user %s") % user.username) if pw != UnixUsers.DeletedPassword or pw_delete: params['pw'] = pw if pw_delete: diff --git a/pym/unix/utils/cl_unix_passwd.py b/pym/unix/utils/cl_unix_passwd.py index a688cfd..b23f4d6 100644 --- a/pym/unix/utils/cl_unix_passwd.py +++ b/pym/unix/utils/cl_unix_passwd.py @@ -58,6 +58,6 @@ class ClUnixPasswdAction(Action): {'name': 'user_change', 'method': 'Unix.modify_user(ur_unix_login,ur_unix_hash,' 'ur_unix_pw_delete_set,' - 'None,None,None,ur_unix_lock_set, None)' + 'None,None,None,ur_unix_lock_set,None,None)' }, ] diff --git a/pym/unix/utils/cl_unix_usermod.py b/pym/unix/utils/cl_unix_usermod.py index e7959fb..e4a3877 100644 --- a/pym/unix/utils/cl_unix_usermod.py +++ b/pym/unix/utils/cl_unix_usermod.py @@ -59,7 +59,7 @@ class ClUnixUsermodAction(Action): 'method': 'Unix.modify_user(ur_unix_login,ur_unix_hash,' 'ur_unix_pw_delete_set,ur_unix_gid,' 'ur_unix_shell,ur_unix_visible_set,ur_unix_lock_set,' - 'ur_unix_comment)', + 'ur_unix_comment,ur_unix_home_path)', }, {'name': 'remove_groups', 'method': 'Unix.remove_user_from_groups(unix.ur_unix_login,'