|
|
|
@ -69,15 +69,15 @@ class VariableUrUnixLogin(UserNameHelper, UnixUserHelper, UnixActionHelper,
|
|
|
|
|
|
|
|
|
|
def check_new(self, value):
|
|
|
|
|
if not value:
|
|
|
|
|
raise VariableError(_("You should specify login"))
|
|
|
|
|
raise VariableError(_("Please specify the login"))
|
|
|
|
|
self.check_user_name(value)
|
|
|
|
|
if value == "list":
|
|
|
|
|
raise VariableError(_("List is using as keyword"))
|
|
|
|
|
raise VariableError(_("List is used as keyword"))
|
|
|
|
|
if self.search_ldap_user_name(value):
|
|
|
|
|
raise VariableError(_("User %s already exists" % value))
|
|
|
|
|
if self.search_system_user_name(value):
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("User %s already exists in /etc/passwd") % value)
|
|
|
|
|
_("User %s is already in /etc/passwd") % value)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableUrUnixLoginExists(UnixUserHelper, UnixActionHelper, Variable):
|
|
|
|
@ -107,7 +107,7 @@ class VariableUrUnixLoginExists(UnixUserHelper, UnixActionHelper, Variable):
|
|
|
|
|
|
|
|
|
|
def raiseWrongChoice(self, name, choiceVal, value, error):
|
|
|
|
|
if not value:
|
|
|
|
|
raise VariableError(_("Please specify user login"))
|
|
|
|
|
raise VariableError(_("Please specify the user login"))
|
|
|
|
|
else:
|
|
|
|
|
raise VariableError(_("%s user not found") % value)
|
|
|
|
|
|
|
|
|
@ -122,7 +122,7 @@ class VariableUrUnixBaseDir(Variable):
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Base directory")
|
|
|
|
|
self.help = _("base directory for the home directory of new account")
|
|
|
|
|
self.help = _("base directory for new account's home")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableUrUnixComment(ExistsUserHelper, UnixActionHelper, Variable):
|
|
|
|
@ -136,7 +136,7 @@ class VariableUrUnixComment(ExistsUserHelper, UnixActionHelper, Variable):
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Full name")
|
|
|
|
|
self.help = _("set fullname of the account")
|
|
|
|
|
self.help = _("set full name for account")
|
|
|
|
|
|
|
|
|
|
def get_new(self):
|
|
|
|
|
return ""
|
|
|
|
@ -154,7 +154,7 @@ class VariableUrUnixHomePath(ExistsUserHelper, UnixActionHelper, Variable):
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Home directory")
|
|
|
|
|
self.help = _("set home directory of the account")
|
|
|
|
|
self.help = _("set home directory for account")
|
|
|
|
|
|
|
|
|
|
def get_exists(self):
|
|
|
|
|
return self.Get('ur_unix_home_path_exists')
|
|
|
|
@ -164,9 +164,9 @@ class VariableUrUnixHomePath(ExistsUserHelper, UnixActionHelper, Variable):
|
|
|
|
|
|
|
|
|
|
def check_exists(self, value):
|
|
|
|
|
if "," in value:
|
|
|
|
|
raise VariableError(_("Wrong home directory"))
|
|
|
|
|
raise VariableError(_("Non-existing home directory"))
|
|
|
|
|
if not value.startswith('/'):
|
|
|
|
|
raise VariableError(_("Home directory path must be absolutly"))
|
|
|
|
|
raise VariableError(_("Home must have an absolute path"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableUrUnixHomePathExists(ExistsUserHelper, UnixActionHelper,
|
|
|
|
@ -188,16 +188,16 @@ class VariableUrUnixHomePathMove(Variable):
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Move home directory")
|
|
|
|
|
self.help = _("move contents of the home directory to the new location")
|
|
|
|
|
self.help = _("move home conents to new location")
|
|
|
|
|
|
|
|
|
|
def check_on(self):
|
|
|
|
|
new_path = self.Get('ur_unix_home_path')
|
|
|
|
|
old_path = self.Get('ur_unix_home_path_exists')
|
|
|
|
|
if new_path == old_path:
|
|
|
|
|
raise VariableError(_("You should change home directory"))
|
|
|
|
|
raise VariableError(_("Please change home directory"))
|
|
|
|
|
if path.exists(new_path):
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("New home directory %s exists") % new_path)
|
|
|
|
|
_("New home directory %s already exists") % new_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableClUnixGroupDefault(Variable):
|
|
|
|
@ -223,8 +223,8 @@ class VariableUrUnixPrimaryGroup(ExistsUserHelper, UnixGroupHelper,
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Primary group")
|
|
|
|
|
self.help = _("set name or ID of primary group of the account "
|
|
|
|
|
"('default' value for create default group)")
|
|
|
|
|
self.help = _("set name or ID of primary group for account "
|
|
|
|
|
"('default' creates a default group)")
|
|
|
|
|
|
|
|
|
|
def get_new(self):
|
|
|
|
|
return self.domain_group
|
|
|
|
@ -246,11 +246,11 @@ class VariableUrUnixPrimaryGroup(ExistsUserHelper, UnixGroupHelper,
|
|
|
|
|
|
|
|
|
|
def check_new(self, value):
|
|
|
|
|
if not value:
|
|
|
|
|
raise VariableError(_("You should specify primary group ID"))
|
|
|
|
|
raise VariableError(_("Please specify the primary group ID"))
|
|
|
|
|
|
|
|
|
|
def check_exists(self, value):
|
|
|
|
|
if not value:
|
|
|
|
|
raise VariableError(_("You should specify primary group ID"))
|
|
|
|
|
raise VariableError(_("Please specify the primary group ID"))
|
|
|
|
|
if value:
|
|
|
|
|
self.check_group(value)
|
|
|
|
|
|
|
|
|
@ -284,7 +284,7 @@ class VariableUrUnixUid(UnixUserHelper, UnixActionHelper, Variable):
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("User ID")
|
|
|
|
|
self.help = _("set user ID of the account")
|
|
|
|
|
self.help = _("set user ID")
|
|
|
|
|
|
|
|
|
|
def get_new(self):
|
|
|
|
|
return self.Get('ur_unix_next_uid')
|
|
|
|
@ -298,12 +298,12 @@ class VariableUrUnixUid(UnixUserHelper, UnixActionHelper, Variable):
|
|
|
|
|
user = self.search_ldap_user_id(value)
|
|
|
|
|
if user:
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("Uid {userid} is used by user {username}").format(
|
|
|
|
|
_("UID {userid} is used by user {username}").format(
|
|
|
|
|
userid=user.uid, username=user.username))
|
|
|
|
|
user = self.search_system_user_id(value)
|
|
|
|
|
if user:
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("Uid {userid} is used by system user {username}").format(
|
|
|
|
|
_("UID {userid} is used by system user {username}").format(
|
|
|
|
|
userid=user.uid, username=user.username))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -317,8 +317,8 @@ class VariableUrUnixGroups(UnixGroupHelper, UnixActionHelper, Variable):
|
|
|
|
|
value = []
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Supplimentary groups")
|
|
|
|
|
self.help = _("set list of supplementary groups of the account")
|
|
|
|
|
self.label = _("Supplementary groups")
|
|
|
|
|
self.help = _("set list of supplementary groups for account")
|
|
|
|
|
|
|
|
|
|
def set(self, value):
|
|
|
|
|
return map(self.gid_to_name, value)
|
|
|
|
@ -388,8 +388,7 @@ class VariableUrUnixGroupsAdd(UnixGroupHelper, UnixActionHelper, Variable):
|
|
|
|
|
replace_groups = self.Get('ur_unix_groups')
|
|
|
|
|
if set(exists_groups) != set(replace_groups):
|
|
|
|
|
raise VariableError(_(
|
|
|
|
|
"Appending user to groups unavailable "
|
|
|
|
|
"with the replace groups using"))
|
|
|
|
|
"You cannot add user to group and replace their groups"))
|
|
|
|
|
login = self.Get('ur_unix_login')
|
|
|
|
|
groups = self.ldap_group_names()
|
|
|
|
|
failed = [x for x in value if x not in groups]
|
|
|
|
@ -408,7 +407,7 @@ class VariableUrUnixGroupsAdd(UnixGroupHelper, UnixActionHelper, Variable):
|
|
|
|
|
|
|
|
|
|
def humanReadable(self):
|
|
|
|
|
if not self.Get():
|
|
|
|
|
return _("Not change")
|
|
|
|
|
return _("Do not change")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableUrUnixGroupsDel(VariableUrUnixGroupsAdd):
|
|
|
|
@ -442,7 +441,7 @@ class VariableUrUnixGroupsDel(VariableUrUnixGroupsAdd):
|
|
|
|
|
not_exists = [x for x in value if x not in exists_groups]
|
|
|
|
|
if not_exists:
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("User {user} is not exist in groups {groups}").format(
|
|
|
|
|
_("No user {user} was found in groups {groups}").format(
|
|
|
|
|
groups=", ".join(not_exists), user=login))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -456,7 +455,7 @@ class VariableUrUnixSkel(Variable):
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Skeleton directory")
|
|
|
|
|
self.help = _("use this alternative skeleton directory")
|
|
|
|
|
self.help = _("use alternative skeleton directory")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableUrUnixCreateHomeSet(Variable):
|
|
|
|
@ -470,7 +469,7 @@ class VariableUrUnixCreateHomeSet(Variable):
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Create home directory")
|
|
|
|
|
self.help = _("create the user's home directory")
|
|
|
|
|
self.help = _("create user's home directory")
|
|
|
|
|
|
|
|
|
|
def check_on(self):
|
|
|
|
|
home_path = self.Get('ur_unix_home_path')
|
|
|
|
@ -502,8 +501,8 @@ class VariableUrUnixPw(Variable):
|
|
|
|
|
raise PasswordError(_("Specify user password"))
|
|
|
|
|
if self.Get('cl_unix_action') in (Actions.Passwd, Actions.UserMod):
|
|
|
|
|
if self.Get('ur_unix_pw_delete_set') == 'on' and value:
|
|
|
|
|
raise VariableError(_("Can not use remove and "
|
|
|
|
|
"set the password options together"))
|
|
|
|
|
raise VariableError(_("You cannot use remove and password "
|
|
|
|
|
"setup options together"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableUrUnixPwSet(UnixActionHelper, UnixUserHelper, ReadonlyVariable):
|
|
|
|
@ -535,7 +534,7 @@ class VariableUrUnixPwDeleteSet(Variable):
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Remove user password")
|
|
|
|
|
self.help = _("delete the password for the named account")
|
|
|
|
|
self.help = _("delete account password")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableUrUnixHash(HashHelper, ReadonlyVariable):
|
|
|
|
@ -568,7 +567,7 @@ class VariableUrUnixShell(ExistsUserHelper, UnixActionHelper, Variable):
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Shell")
|
|
|
|
|
self.help = _("login shell of the account")
|
|
|
|
|
self.help = _("account's login shell")
|
|
|
|
|
|
|
|
|
|
def get_new(self):
|
|
|
|
|
return "/bin/bash"
|
|
|
|
@ -584,7 +583,7 @@ class VariableUrUnixVisibleSet(ExistsUserHelper, UnixActionHelper, Variable):
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Visible")
|
|
|
|
|
self.help = _("set visible of the account")
|
|
|
|
|
self.help = _("manage account visibility")
|
|
|
|
|
|
|
|
|
|
def get_new(self):
|
|
|
|
|
return "on"
|
|
|
|
@ -603,7 +602,7 @@ class VariableUrUnixLockSet(ExistsUserHelper, UnixActionHelper, Variable):
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Locked")
|
|
|
|
|
self.help = _("lock the account")
|
|
|
|
|
self.help = _("lock account")
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
return "auto"
|
|
|
|
|