Browse Source

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

tags/3.5.0_alpha1
parent
commit
475851f81a
3 changed files with 44 additions and 29 deletions
  1. +30
    -10
      pym/unix/unix.py
  2. +5
    -5
      pym/unix/utils/cl_unix_passwd.py
  3. +9
    -14
      pym/unix/variables/users.py

+ 30
- 10
pym/unix/unix.py View File

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


+ 5
- 5
pym/unix/utils/cl_unix_passwd.py View File

@@ -44,9 +44,9 @@ class ClUnixPasswdAction(Action):
UnixError,
LdapError)

successMessage = __("Password for user {ur_unix_login} in Unix service changed!")
failedMessage = __("Failed to change password for user {ur_unix_login} in Unix server!")
interruptMessage = __("User password changing manually interrupted")
successMessage = __("User {ur_unix_login} modified in Unix service!")
failedMessage = __("Failed to modify user {ur_unix_login} in Unix server!")
interruptMessage = __("Modifing of user manually interrupted")

stop_tasks = [
]
@@ -57,7 +57,7 @@ class ClUnixPasswdAction(Action):
tasks = [
{'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)'
'ur_unix_pw_delete_set,'
'None,None,None,ur_unix_lock_set,None,None)'
},
]

+ 9
- 14
pym/unix/variables/users.py View File

@@ -468,10 +468,9 @@ class VariableUrUnixPw(Variable):

def check(self, value):
delete_pw = self.GetBool('ur_unix_pw_delete_set')
change_lock = (self.GetBool('ur_unix_lock_set') !=
self.GetBool('ur_unix_lock_exists_set'))
change_lock = self.GetBool('ur_unix_lock_set')
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"))
if self.Get('cl_unix_action') in (Actions.Passwd, Actions.UserMod):
if self.Get('ur_unix_pw_delete_set') == 'on' and value:
@@ -552,7 +551,7 @@ class VariableUrUnixVisibleSet(ExistsUserHelper, UnixActionHelper, Variable):
Виден ли пользователь
"""
attribute = "visible"
type = "bool"
type = "boolauto"
opt = ("-v", "--visible")

def init(self):
@@ -562,28 +561,24 @@ class VariableUrUnixVisibleSet(ExistsUserHelper, UnixActionHelper, Variable):
def get_new(self):
return "on"

def get_exists(self):
return "auto"


class VariableUrUnixLockSet(ExistsUserHelper, UnixActionHelper, Variable):
"""
Виден ли пользователь
"""
attribute = "lock"
type = "bool"
type = "boolauto"
opt = ("-l", "--lock")
value = "off"

def init(self):
self.label = _("Locked")
self.help = _("lock the account")


class VariableUrUnixLockExistsSet(ExistsUserHelper, UnixActionHelper, Variable):
"""
Виден ли пользователь
"""
type = "bool"
attribute = "lock"
value = "off"
def get(self):
return "auto"


class VariableUrUnixVisibleFlag(UnixUserHelper, ReadonlyVariable):


Loading…
Cancel
Save