Browse Source

Множественные исправления

tags/3.5.0_alpha1
parent
commit
a44ceca991
4 changed files with 22 additions and 9 deletions
  1. +12
    -4
      pym/unix/unix.py
  2. +0
    -2
      pym/unix/utils/cl_unix_usermod.py
  3. +5
    -0
      pym/unix/variables/groups.py
  4. +5
    -3
      pym/unix/variables/users.py

+ 12
- 4
pym/unix/unix.py View File

@@ -633,7 +633,15 @@ class Unix(Ldap):
"""
Преместить домашнюю директорию пользователя
"""
if not path.exists(homedir):
self.printWARNING(_("Previous home directory %s not found")
% homedir)
return True
try:
self.printSUCCESS(
_("User home directory {homedir} "
"moved to {new_homedir}").format(
homedir=homedir, new_homedir=new_homedir))
dirname = path.dirname(new_homedir)
if not path.exists(dirname):
os.makedirs(dirname)
@@ -735,10 +743,10 @@ class Unix(Ldap):
fields=table_fields,
onClick='unix_groupmod' if any(table_fields) else None,
addAction='unix_groupadd',
records=str(maxi+1))
records=str(maxi + 1))
if any(body):
num_page, count_page = getPagesInterval(
count, offset, maxi+1)
count, offset, maxi + 1)
self.printSUCCESS(_('page %d from ') % num_page + str(count_page))
return True

@@ -864,10 +872,10 @@ class Unix(Ldap):
fields=table_fields,
onClick='unix_usermod' if any(table_fields) else None,
addAction='unix_useradd',
records=str(maxi+1))
records=str(maxi + 1))
if any(body):
num_page, count_page = getPagesInterval(
count, offset, maxi+1)
count, offset, maxi + 1)
self.printSUCCESS(_('page %d from ') % num_page + str(count_page))
return True



+ 0
- 2
pym/unix/utils/cl_unix_usermod.py View File

@@ -72,8 +72,6 @@ class ClUnixUsermodAction(Action):
'condition': lambda Get: Get('unix.ur_unix_groups_add')
},
{'name': 'move_homedir',
'message': _("User home directory {unix.ur_unix_home_path_exists} "
"moved to {unix.ur_unix_home_path}"),
'method': 'Unix.move_home_directory(unix.ur_unix_home_path_exists,'
'unix.ur_unix_home_path)',
'condition': lambda Get: Get('unix.ur_unix_home_path_move') == 'on'


+ 5
- 0
pym/unix/variables/groups.py View File

@@ -56,6 +56,8 @@ class VariableUrUnixGroupName(LdapSearchHelper, UnixActionHelper, Variable):
raise VariableError(_("You should specify group name"))
if not re.match("^[a-zA-Z_]([a-zA-Z0-9_ -]*[a-zA-Z0-9_-])?$", value):
raise VariableError(_("Wrong group name"))
if value == "list":
raise VariableError(_("List is using as keyword"))
if self.check_name(value):
raise VariableError(_("Group name already exists"))

@@ -481,3 +483,6 @@ class VariableUrUnixGroupShow(UnixGroupHelper,
if value:
if not self.search_ldap_group_name(value):
raise VariableError(_("%s group not found") % value)

def raiseWrongChoice(self, name, choiceVal, value, error):
raise VariableError(_("Wrong group name"))

+ 5
- 3
pym/unix/variables/users.py View File

@@ -58,6 +58,8 @@ class VariableUrUnixLogin(UnixUserHelper, UnixActionHelper, Variable):
raise VariableError(_("You should specify login"))
if not re.match("^[a-zA-Z_]([a-zA-Z0-9_ -]*[a-zA-Z0-9_-])?$", value):
raise VariableError(_("Wrong user login"))
if value == "list":
raise VariableError(_("List is using as keyword"))
if self.search_ldap_user_name(value):
raise VariableError(_("User %s already exists" % value))
if self.search_system_user_name(value):
@@ -183,9 +185,6 @@ class VariableUrUnixHomePathMove(Variable):
if path.exists(new_path):
raise VariableError(
_("New home directory %s exists") % new_path)
if not path.exists(old_path):
raise VariableError(
_("Previous home directory %s not found") % old_path)


class VariableClUnixGroupDefault(Variable):
@@ -719,3 +718,6 @@ class VariableUrUnixUserShow(UnixUserHelper, UnixActionHelper, Variable):
if value:
if not self.search_ldap_user_name(value):
raise VariableError(_("%s user not found") % value)

def raiseWrongChoice(self, name, choiceVal, value, error):
raise VariableError(_("Wrong user name"))

Loading…
Cancel
Save