Изменена настройка блокировки пользователя

legacy27
parent 7f63d5cafc
commit 475851f81a

@ -592,18 +592,38 @@ class Unix(Ldap):
params['shell'] = shell params['shell'] = shell
self.printSUCCESS( self.printSUCCESS(
_("Changed shell for user %s") % user.username) _("Changed shell for user %s") % user.username)
if visible is not None and user.visible != visible: if visible is not None:
params['visible'] = visible if user.visible != visible:
if visible: params['visible'] = visible
self.printSUCCESS(_("User %s is visible") % user.username) if visible:
self.printSUCCESS(
_("User %s is visible") % user.username)
else:
self.printSUCCESS(
_("User %s is unvisible") % user.username)
else: else:
self.printSUCCESS(_("User %s is unvisible") % user.username) if visible:
if lock is not None and user.lock != lock: self.printWARNING(
params['lock'] = lock _("User %s is visible already") % user.username)
if lock: else:
self.printSUCCESS(_("User %s is locked") % user.username) self.printWARNING(
_("User %s is unvisible already") % user.username)
if lock is not None:
if user.lock != lock:
params['lock'] = lock
if lock:
self.printSUCCESS(
_("User %s is locked") % user.username)
else:
self.printSUCCESS(
_("User %s is unlocked") % user.username)
else: else:
self.printSUCCESS(_("User %s is unlocked") % user.username) if lock:
self.printWARNING(
_("User %s is locked already") % user.username)
else:
self.printWARNING(
_("User %s is unlocked already") % user.username)
uu.modify_user(user.username, **params) uu.modify_user(user.username, **params)
else: else:
raise UnixError(_("User %s not found") % user) raise UnixError(_("User %s not found") % user)

@ -44,9 +44,9 @@ class ClUnixPasswdAction(Action):
UnixError, UnixError,
LdapError) LdapError)
successMessage = __("Password for user {ur_unix_login} in Unix service changed!") successMessage = __("User {ur_unix_login} modified in Unix service!")
failedMessage = __("Failed to change password for user {ur_unix_login} in Unix server!") failedMessage = __("Failed to modify user {ur_unix_login} in Unix server!")
interruptMessage = __("User password changing manually interrupted") interruptMessage = __("Modifing of user manually interrupted")
stop_tasks = [ stop_tasks = [
] ]
@ -57,7 +57,7 @@ class ClUnixPasswdAction(Action):
tasks = [ tasks = [
{'name': 'user_change', {'name': 'user_change',
'method': 'Unix.modify_user(ur_unix_login,ur_unix_hash,' 'method': 'Unix.modify_user(ur_unix_login,ur_unix_hash,'
'ur_unix_pw_delete_set,' 'ur_unix_pw_delete_set,'
'None,None,None,ur_unix_lock_set,None,None)' 'None,None,None,ur_unix_lock_set,None,None)'
}, },
] ]

@ -468,10 +468,9 @@ class VariableUrUnixPw(Variable):
def check(self, value): def check(self, value):
delete_pw = self.GetBool('ur_unix_pw_delete_set') delete_pw = self.GetBool('ur_unix_pw_delete_set')
change_lock = (self.GetBool('ur_unix_lock_set') != change_lock = self.GetBool('ur_unix_lock_set')
self.GetBool('ur_unix_lock_exists_set'))
if (self.Get('cl_unix_action') == Actions.Passwd and if (self.Get('cl_unix_action') == Actions.Passwd and
not delete_pw and not change_lock and not value): not delete_pw and change_lock is None and not value):
raise PasswordError(_("Specify user password")) raise PasswordError(_("Specify user password"))
if self.Get('cl_unix_action') in (Actions.Passwd, Actions.UserMod): if self.Get('cl_unix_action') in (Actions.Passwd, Actions.UserMod):
if self.Get('ur_unix_pw_delete_set') == 'on' and value: if self.Get('ur_unix_pw_delete_set') == 'on' and value:
@ -552,7 +551,7 @@ class VariableUrUnixVisibleSet(ExistsUserHelper, UnixActionHelper, Variable):
Виден ли пользователь Виден ли пользователь
""" """
attribute = "visible" attribute = "visible"
type = "bool" type = "boolauto"
opt = ("-v", "--visible") opt = ("-v", "--visible")
def init(self): def init(self):
@ -562,28 +561,24 @@ class VariableUrUnixVisibleSet(ExistsUserHelper, UnixActionHelper, Variable):
def get_new(self): def get_new(self):
return "on" return "on"
def get_exists(self):
return "auto"
class VariableUrUnixLockSet(ExistsUserHelper, UnixActionHelper, Variable): class VariableUrUnixLockSet(ExistsUserHelper, UnixActionHelper, Variable):
""" """
Виден ли пользователь Виден ли пользователь
""" """
attribute = "lock" attribute = "lock"
type = "bool" type = "boolauto"
opt = ("-l", "--lock") opt = ("-l", "--lock")
value = "off"
def init(self): def init(self):
self.label = _("Locked") self.label = _("Locked")
self.help = _("lock the account") self.help = _("lock the account")
def get(self):
class VariableUrUnixLockExistsSet(ExistsUserHelper, UnixActionHelper, Variable): return "auto"
"""
Виден ли пользователь
"""
type = "bool"
attribute = "lock"
value = "off"
class VariableUrUnixVisibleFlag(UnixUserHelper, ReadonlyVariable): class VariableUrUnixVisibleFlag(UnixUserHelper, ReadonlyVariable):

Loading…
Cancel
Save