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

legacy27 3.5.0_alpha1
parent ae7aeacc19
commit a44ceca991

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

@ -72,8 +72,6 @@ class ClUnixUsermodAction(Action):
'condition': lambda Get: Get('unix.ur_unix_groups_add') 'condition': lambda Get: Get('unix.ur_unix_groups_add')
}, },
{'name': 'move_homedir', {'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,' 'method': 'Unix.move_home_directory(unix.ur_unix_home_path_exists,'
'unix.ur_unix_home_path)', 'unix.ur_unix_home_path)',
'condition': lambda Get: Get('unix.ur_unix_home_path_move') == 'on' 'condition': lambda Get: Get('unix.ur_unix_home_path_move') == 'on'

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

@ -58,6 +58,8 @@ class VariableUrUnixLogin(UnixUserHelper, UnixActionHelper, Variable):
raise VariableError(_("You should specify login")) raise VariableError(_("You should specify login"))
if not re.match("^[a-zA-Z_]([a-zA-Z0-9_ -]*[a-zA-Z0-9_-])?$", value): if not re.match("^[a-zA-Z_]([a-zA-Z0-9_ -]*[a-zA-Z0-9_-])?$", value):
raise VariableError(_("Wrong user login")) raise VariableError(_("Wrong user login"))
if value == "list":
raise VariableError(_("List is using as keyword"))
if self.search_ldap_user_name(value): if self.search_ldap_user_name(value):
raise VariableError(_("User %s already exists" % value)) raise VariableError(_("User %s already exists" % value))
if self.search_system_user_name(value): if self.search_system_user_name(value):
@ -183,9 +185,6 @@ class VariableUrUnixHomePathMove(Variable):
if path.exists(new_path): if path.exists(new_path):
raise VariableError( raise VariableError(
_("New home directory %s exists") % new_path) _("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): class VariableClUnixGroupDefault(Variable):
@ -719,3 +718,6 @@ class VariableUrUnixUserShow(UnixUserHelper, UnixActionHelper, Variable):
if value: if value:
if not self.search_ldap_user_name(value): if not self.search_ldap_user_name(value):
raise VariableError(_("%s user not found") % value) raise VariableError(_("%s user not found") % value)
def raiseWrongChoice(self, name, choiceVal, value, error):
raise VariableError(_("Wrong user name"))

Loading…
Cancel
Save