Подготовока к alpha

legacy27
parent a47c27854c
commit 6e015e738b

@ -103,7 +103,7 @@ class UnixGroups(object):
yield UnixGroup( yield UnixGroup(
group['cn'][0], group['cn'][0],
int(group['gidNumber'][0]), int(group['gidNumber'][0]),
group.get('memberUid', []), sorted(group.get('memberUid', [])),
group['description'][0]) group['description'][0])
def search_ldap_group(self, search_filter): def search_ldap_group(self, search_filter):
@ -554,7 +554,7 @@ class Unix(Ldap):
login=user, groups=", ".join(groups))) login=user, groups=", ".join(groups)))
return True return True
def modify_user(self, login, pw, gid, shell, visible, lock, comment): def modify_user(self, login, pw, pw_delete, gid, shell, visible, lock, comment):
"""" """"
Изменить параметры пользователя в LDAP Изменить параметры пользователя в LDAP
""" """
@ -572,10 +572,14 @@ class Unix(Ldap):
params['comment'] = comment params['comment'] = comment
self.printSUCCESS( self.printSUCCESS(
_("Changed comment for user %s") % user.username) _("Changed comment for user %s") % user.username)
if pw: if pw != UnixUsers.DeletedPassword or pw_delete:
params['pw'] = pw params['pw'] = pw
self.printSUCCESS( if pw_delete:
_("Changed password for user %s") % user.username) self.printSUCCESS(
_("Removed password for user %s") % user.username)
else:
self.printSUCCESS(
_("Changed password for user %s") % user.username)
if shell and user.shell != shell: if shell and user.shell != shell:
params['shell'] = shell params['shell'] = shell
self.printSUCCESS( self.printSUCCESS(
@ -636,9 +640,10 @@ class Unix(Ldap):
raise UnixError(_("Failed to create user home directory")) raise UnixError(_("Failed to create user home directory"))
return True return True
def show_groups(self, fields, count, offset): def show_groups(self, groupname, fields, count, offset):
dv = self.clVars dv = self.clVars
fields = ["ur_unix_group_name"] + list(fields)
head = [dv.getInfo(x).label for x in fields] head = [dv.getInfo(x).label for x in fields]
body = [] body = []
ldap_connect = self.clVars.Get('ldap.cl_ldap_connect') ldap_connect = self.clVars.Get('ldap.cl_ldap_connect')
@ -652,12 +657,12 @@ class Unix(Ldap):
for x in ('cl_unix_group_filter_name', for x in ('cl_unix_group_filter_name',
'cl_unix_group_filter_id', 'cl_unix_group_filter_id',
'cl_unix_group_filter_comment', 'cl_unix_group_filter_comment',
'cl_unix_group_filter_users', 'cl_unix_group_filter_users'))
'cl_unix_group_filter_primary'))
filters = [x.test for x in filters if x.enabled()] filters = [x.test for x in filters if x.enabled()]
def all_users(group): def all_users(group):
for user in uu.iterate_ldap_user("gidNumber=%d" % group.gid): for user in sorted(uu.iterate_ldap_user("gidNumber=%d" % group.gid),
key=lambda x: x.username):
yield "<%s>" % user.username yield "<%s>" % user.username
for user in group.user_list: for user in group.user_list:
yield user yield user
@ -669,29 +674,47 @@ class Unix(Ldap):
'ur_unix_group_users': lambda group: ", ".join(all_users(group)) 'ur_unix_group_users': lambda group: ", ".join(all_users(group))
} }
for group in ug.iterate_ldap_group("cn=*", offset, count):
if all(x(group) for x in filters):
body.append([variables_mapping.get(x)(group) for x in fields])
mapping = {'ur_unix_group_name': 'ur_unix_group_name_exists'} mapping = {'ur_unix_group_name': 'ur_unix_group_name_exists'}
maxi = 0
try:
for i, group in enumerate(sorted(
(group for group in
ug.iterate_ldap_group("cn=*")
if all(x(group) for x in filters)),
key=lambda x: x.group_name)):
maxi = i
if offset <= i < offset + count:
body.append(
[variables_mapping.get(x)(group) for x in fields])
except LDAPBadSearchFilter:
raise UnixError(_("Wrong group pattern"))
table_fields = [mapping.get(x, '') for x in fields] table_fields = [mapping.get(x, '') for x in fields]
if not body: if not body:
body = [[]] body = [[]]
dv.Invalidate('ur_unix_group_count') dv.Invalidate('ur_unix_group_count')
if any(body):
head_message = _("Groups")
elif dv.GetInteger("ur_unix_group_count"):
head_message = _("Groups not found")
else:
head_message = _("No groups")
self.printTable( self.printTable(
_("Groups") if any(body) else _("No groups"), head, body, head_message, head, body,
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=self.clVars.Get('core.cl_page_max')) records=str(maxi))
if any(body): if any(body):
num_page, count_page = getPagesInterval( num_page, count_page = getPagesInterval(
count, offset, int(self.clVars.Get('core.cl_page_max'))) count, offset, maxi)
self.printSUCCESS(_('page %d from ') % num_page + str(count_page)) self.printSUCCESS(_('page %d from ') % num_page + str(count_page))
return True return True
def show_group(self, groupname): def show_group(self, groupname):
print groupname
dv = self.clVars dv = self.clVars
list_group_name = sorted(dv.Choice('cl_core_group')) list_group_name = sorted(dv.Choice('cl_core_group'))
@ -718,12 +741,16 @@ class Unix(Ldap):
body.append([varobj.label or "", varval]) body.append([varobj.label or "", varval])
if body: if body:
self.printTable(_("Group info"), head, body) self.printTable(_("Group info"), head, body,
onClick="unix_groupmod",
records="0",
fields=["ur_unix_group_name_exists:%s" % groupname])
return True return True
def show_users(self, login, fields, count, offset): def show_users(self, login, fields, count, offset):
dv = self.clVars dv = self.clVars
fields = ["ur_unix_login"] + list(fields)
head = [dv.getInfo(x).label for x in fields] head = [dv.getInfo(x).label for x in fields]
body = [] body = []
ldap_connect = self.clVars.Get('ldap.cl_ldap_connect') ldap_connect = self.clVars.Get('ldap.cl_ldap_connect')
@ -765,11 +792,17 @@ class Unix(Ldap):
} }
mapping = {'ur_unix_login': 'ur_unix_login_exists'} mapping = {'ur_unix_login': 'ur_unix_login_exists'}
maxi = 0
try: try:
for user in uu.iterate_ldap_user("uid=%s" % login, offset, count): for i, user in enumerate(sorted(
if all(x(user) for x in filters): (user for user in uu.iterate_ldap_user("uid=*")
if all(x(user) for x in filters)),
key=lambda x: x.username)):
maxi = i
if offset <= i < offset + count:
body.append( body.append(
[variables_mapping.get(x)(user) for x in fields]) [variables_mapping.get(x)(user) for x in fields])
except LDAPBadSearchFilter: except LDAPBadSearchFilter:
raise UnixError(_("Wrong user pattern")) raise UnixError(_("Wrong user pattern"))
table_fields = [mapping.get(x, '') for x in fields] table_fields = [mapping.get(x, '') for x in fields]
@ -777,15 +810,21 @@ class Unix(Ldap):
if not body: if not body:
body = [[]] body = [[]]
dv.Invalidate('ur_unix_user_count') dv.Invalidate('ur_unix_user_count')
self.printTable(_("Users") if any(body) else _("No Users"), if any(body):
head_message = _("Users")
elif dv.GetInteger("ur_unix_user_count"):
head_message = _("Users not found")
else:
head_message = _("No users")
self.printTable(head_message,
head, body, head, body,
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(self.clVars.Get('unix.ur_unix_user_count'))) records=str(maxi))
if any(body): if any(body):
num_page, count_page = getPagesInterval( num_page, count_page = getPagesInterval(
count, offset, int(self.clVars.Get('unix.ur_unix_user_count'))) count, offset, maxi)
self.printSUCCESS(_('page %d from ') % num_page + str(count_page)) self.printSUCCESS(_('page %d from ') % num_page + str(count_page))
return True return True
@ -818,7 +857,10 @@ class Unix(Ldap):
body.append([varobj.label or "", varval]) body.append([varobj.label or "", varval])
if body: if body:
self.printTable(_("User info"), head, body) self.printTable(_("User info"), head, body,
onClick="unix_usermod",
records="0",
fields=["ur_unix_login_exists:%s" % user])
return True return True
def try_remove_primary_group(self, user, primary_group): def try_remove_primary_group(self, user, primary_group):

@ -56,10 +56,6 @@ class ClUnixGroupdelAction(Action):
# список задач для действия # список задач для действия
tasks = [ tasks = [
{'name': 'remove_group_users',
'message': _("Users {unix.ur_unix_group_users} removed "
"from group {unix.ur_unix_group_name}"),
},
{'name': 'remove_group', {'name': 'remove_group',
'method': 'Unix.remove_group(unix.ur_unix_group_name)' 'method': 'Unix.remove_group(unix.ur_unix_group_name)'
}, },

@ -53,12 +53,13 @@ class ClUnixGroupshowAction(Action):
# список задач для действия # список задач для действия
tasks = [ tasks = [
{'name': 'view_groups', {'name': 'view_groups',
'method': 'Unix.show_groups(unix.cl_unix_group_show_fields,' 'method': 'Unix.show_groups(unix.ur_unix_group_show,'
'unix.cl_unix_group_show_fields,'
'core.cl_page_count,core.cl_page_offset)', 'core.cl_page_count,core.cl_page_offset)',
'condition': lambda Get: Get('ur_unix_group_show') == "all" 'condition': lambda Get: not Get('ur_unix_group_show')
}, },
{'name': 'view_group', {'name': 'view_group',
'method': 'Unix.show_group(ur_unix_group_show)', 'method': 'Unix.show_group(ur_unix_group_show)',
'condition': lambda Get: Get('ur_unix_group_show') != "all" 'condition': lambda Get: Get('ur_unix_group_show')
} }
] ]

@ -57,6 +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,'
'None,None,None,ur_unix_lock_set, None)' 'None,None,None,ur_unix_lock_set, None)'
}, },
] ]

@ -82,6 +82,9 @@ class ClUnixSetupAction(Action):
'tasks': meta_tasks.ldif_task("ldap.ld_admin_dn,ldap.ld_admin_pw", 'tasks': meta_tasks.ldif_task("ldap.ld_admin_dn,ldap.ld_admin_pw",
Actions.Setup) Actions.Setup)
}, },
{'name': 'set_unix',
'method': 'Server.service_install("unix")'
},
{'name': 'templates', {'name': 'templates',
'message': __("Configure LDAP"), 'message': __("Configure LDAP"),
'method': 'Server.applyTemplates(install.cl_source,' 'method': 'Server.applyTemplates(install.cl_source,'
@ -90,9 +93,6 @@ class ClUnixSetupAction(Action):
{'name': 'save_creds', {'name': 'save_creds',
'method': 'Server.save_service_data("unix",ld_unix_dn,ld_unix_pw)' 'method': 'Server.save_service_data("unix",ld_unix_dn,ld_unix_pw)'
}, },
{'name': 'set_unix',
'method': 'Server.service_install("unix")'
},
{'name': 'restart_slapd', {'name': 'restart_slapd',
'message': __("Restarting LDAP service"), 'message': __("Restarting LDAP service"),
'method': 'Server.restart_service("%s")' % Ldap.Service.LDAP, 'method': 'Server.restart_service("%s")' % Ldap.Service.LDAP,

@ -57,8 +57,6 @@ class ClUnixUserdelAction(Action):
# список задач для действия # список задач для действия
tasks = [ tasks = [
{'name': 'remove_group_users', {'name': 'remove_group_users',
'message': _("User {unix.ur_unix_login} removed "
"from groups {unix.ur_unix_groups}"),
'method': 'Unix.remove_user_from_groups(unix.ur_unix_login,' 'method': 'Unix.remove_user_from_groups(unix.ur_unix_login,'
'unix.ur_unix_groups)', 'unix.ur_unix_groups)',
'condition': lambda Get: Get('unix.ur_unix_groups') 'condition': lambda Get: Get('unix.ur_unix_groups')

@ -56,7 +56,8 @@ class ClUnixUsermodAction(Action):
# список задач для действия # список задач для действия
tasks = [ tasks = [
{'name': 'user_change', {'name': 'user_change',
'method': 'Unix.modify_user(ur_unix_login,ur_unix_pw,ur_unix_gid,' 'method': 'Unix.modify_user(ur_unix_login,ur_unix_hash,'
'ur_unix_pw_delete_set,ur_unix_gid,'
'ur_unix_shell,ur_unix_visible_set,ur_unix_lock_set,' 'ur_unix_shell,ur_unix_visible_set,ur_unix_lock_set,'
'ur_unix_comment)', 'ur_unix_comment)',
}, },

@ -56,10 +56,10 @@ class ClUnixUsershowAction(Action):
'method': 'Unix.show_users(unix.ur_unix_user_show,' 'method': 'Unix.show_users(unix.ur_unix_user_show,'
'unix.cl_unix_user_show_fields,' 'unix.cl_unix_user_show_fields,'
'core.cl_page_count,core.cl_page_offset)', 'core.cl_page_count,core.cl_page_offset)',
'condition': lambda Get: "*" in Get('ur_unix_user_show') 'condition': lambda Get: not Get('ur_unix_user_show')
}, },
{'name': 'view_user', {'name': 'view_user',
'method': 'Unix.show_user(ur_unix_user_show)', 'method': 'Unix.show_user(ur_unix_user_show)',
'condition': lambda Get: "*" not in Get('ur_unix_user_show') 'condition': lambda Get: Get('ur_unix_user_show')
} }
] ]

@ -34,7 +34,6 @@ class VariableClUnixAction(UnixGroupHelper, UnixUserHelper, Variable):
if (value not in Actions.All and if (value not in Actions.All and
not self.GetBool('server.sr_unix_set')): not self.GetBool('server.sr_unix_set')):
raise VariableError(_("Unix service is not setup")) raise VariableError(_("Unix service is not setup"))
# TODO: возможно отлавливать ошибку LDAP
if value in Actions.UserExists and not self.ldap_user_list(): if value in Actions.UserExists and not self.ldap_user_list():
raise VariableError(_("Unix service has not users")) raise VariableError(_("Unix service has not users"))
if value in Actions.GroupExists and not self.ldap_group_list(): if value in Actions.GroupExists and not self.ldap_group_list():

@ -18,8 +18,11 @@ import sys
import re import re
from fnmatch import fnmatch from fnmatch import fnmatch
from calculate.lib.datavars import (Variable, VariableInterface, VariableError) from calculate.lib.datavars import (Variable, VariableInterface, VariableError)
from calculate.unix.variables.helpers import (UnixUserHelper, UnixGroupHelper) from calculate.unix.variables.helpers import (UnixUserHelper, UnixGroupHelper,
UnixActionHelper)
from calculate.lib.cl_ldap import LDAPConnectError
import operator import operator
from itertools import chain
_ = lambda x: x _ = lambda x: x
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate) from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate)
@ -173,7 +176,6 @@ class VariableClUnixUserFilterLogin(FilterStringHelper, Variable):
""" """
Фильтр на login Фильтр на login
""" """
opt = ["--filter-login"]
def init(self): def init(self):
self.label = _("Login filter") self.label = _("Login filter")
@ -269,8 +271,8 @@ class VariableClUnixUserFilterUid(FilterIntegerHelper, Variable):
opt = ["--filter-uid"] opt = ["--filter-uid"]
def init(self): def init(self):
self.label = _("Uid filter") self.label = _("User ID filter")
self.help = _("set uid filter") self.help = _("set user ID filter")
def test(self, user): def test(self, user):
return self.test_value(user.uid) return self.test_value(user.uid)
@ -360,33 +362,19 @@ class VariableClUnixGroupFilterComment(FilterStringHelper, Variable):
return self.test_value(group.comment) return self.test_value(group.comment)
class VariableClUnixGroupFilterUsers(FilterListHelper, Variable): class VariableClUnixGroupFilterUsers(FilterListHelper, UnixUserHelper,
Variable):
""" """
Фильтр на наличие пользователей в группе Фильтр на наличие пользователей в группе
""" """
opt = ["--filter-users"] opt = ["--filter-users"]
def init(self):
self.label = _("Users filter")
self.help = _("set users filter")
def test(self, group):
return self.test_value(group.user_list)
class VariableClUnixGroupFilterPrimary(FilterListHelper, UnixUserHelper,
Variable):
"""
Фильтр на наличие пользователей в primary-group
"""
opt = ["--filter-primary"]
def init(self): def init(self):
self.label = _("Users filter") self.label = _("Users filter")
self.help = _("set users filter") self.help = _("set users filter")
def test(self, group): def test(self, group):
return self.test_value( return self.test_value(
user.username for user in self.iterate_ldap_user( chain(group.user_list,
"gidNumber=%d" % group.gid) (user.username for user in self.iterate_ldap_user(
) "gidNumber=%d" % group.gid))))

@ -408,32 +408,12 @@ class VariableUrUnixGroupNewname(UnixGroupHelper, Variable):
return value return value
class VariableUrUnixGroupShow(UnixGroupHelper, UnixActionHelper, Variable):
"""
Группа
"""
type = "choice"
opt = ["-G", "--group"]
metavalue = "GROUP"
def init(self):
self.label = _("Group name")
self.help = _("show group")
def get(self):
return "all"
def choice_exists(self):
return ([("all", _("All"))]
+ self.ldap_group_list())
class VariableClUnixGroupAliases(ReadonlyVariable): class VariableClUnixGroupAliases(ReadonlyVariable):
""" """
Алиасы для переменных Алиасы для переменных
""" """
type = "table" type = "table"
value = [('name', 'ur_unix_group_name'), value = [#('name', 'ur_unix_group_name'),
('id', 'ur_unix_group_id'), ('id', 'ur_unix_group_id'),
('comment', 'ur_unix_group_comment'), ('comment', 'ur_unix_group_comment'),
('users', 'ur_unix_group_users')] ('users', 'ur_unix_group_users')]
@ -469,3 +449,28 @@ class VariableClUnixGroupShowFields(ReadonlyVariable):
def get(self): def get(self):
mapping = dict(self.Get('cl_unix_group_aliases')) mapping = dict(self.Get('cl_unix_group_aliases'))
return [mapping[x] for x in self.Get('cl_unix_group_fields')] return [mapping[x] for x in self.Get('cl_unix_group_fields')]
class VariableUrUnixGroupShow(UnixGroupHelper,
UnixActionHelper, Variable):
"""
Фильтр на group name
"""
type = "choiceedit"
opt = ["ur_unix_group_show"]
metavalue = "GROUP"
value = ""
def init(self):
self.label = _("Group name")
self.help = _("show group")
def choice_exists(self):
return [("","")] + self.ldap_group_list()
def check_exists(self, value):
if value:
if not self.search_ldap_group_name(value):
raise VariableError(_("%s group not found") % value)

@ -76,10 +76,33 @@ class VariableLdUnixPw(ServerEnvHelper, RandomPasswordHelper, Variable):
""" """
password_len = 9 password_len = 9
service = "unix" service = "unix"
parameter = "pass" parameter = "PASS"
@property @property
def fallback_value(self): def fallback_value(self):
return "test22" return "test22"
return RandomPasswordHelper.get(self)
def get(self):
if self.Get('ld_unix_pw_generate_set') == 'on':
return "test22"
return RandomPasswordHelper.get(self)
else:
super(VariableLdUnixPw, self).get()
class VariableLdUnixPwGenerateSet(Variable):
"""
Перегенерировать пароль или нет
"""
type = "bool"
opt = ("-g", "--gen-password")
def init(self):
self.label = _("Generate new service password")
self.help = _("generate new service password")
def get(self):
if self.Get('server.sr_unix_set') == 'on':
return "off"
else:
return "on"

@ -124,6 +124,7 @@ class VariableUrUnixComment(ExistsUserHelper, UnixActionHelper, Variable):
return "" return ""
# self._value_formatter.format(self.value_format, self.Get) # self._value_formatter.format(self.value_format, self.Get)
class VariableUrUnixHomePath(ExistsUserHelper, UnixActionHelper, Variable): class VariableUrUnixHomePath(ExistsUserHelper, UnixActionHelper, Variable):
""" """
Путь до домашней директории Путь до домашней директории
@ -247,7 +248,6 @@ class VariableUrUnixGid(UnixGroupHelper, ReadonlyVariable):
return self.Get('ur_unix_next_gid') return self.Get('ur_unix_next_gid')
class VariableUrUnixUid(UnixUserHelper, UnixActionHelper, Variable): class VariableUrUnixUid(UnixUserHelper, UnixActionHelper, Variable):
""" """
UID пользователя UID пользователя
@ -459,6 +459,7 @@ class VariableUrUnixPw(Variable):
value = "" value = ""
untrusted = True untrusted = True
metavalue = "PASSWORD" metavalue = "PASSWORD"
check_after = ["ur_unix_pw_delete_set", 'ur_unix_lock_set']
def init(self): def init(self):
self.label = _("Password") self.label = _("Password")
@ -468,9 +469,14 @@ class VariableUrUnixPw(Variable):
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')) self.GetBool('ur_unix_lock_exists_set'))
print delete_pw, change_lock, self.GetBool('ur_unix_lock_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 not change_lock 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('ur_unix_pw_delete_set') == 'on' and value:
raise VariableError(_("Can not use remove and "
"set the password options together"))
class VariableUrUnixPwSet(UnixActionHelper, UnixUserHelper, ReadonlyVariable): class VariableUrUnixPwSet(UnixActionHelper, UnixUserHelper, ReadonlyVariable):
@ -498,7 +504,7 @@ class VariableUrUnixPwDeleteSet(Variable):
type = "bool" type = "bool"
value = "off" value = "off"
opt = ("-d", "--delete") opt = ("--delete-password",)
def init(self): def init(self):
self.label = _("Remove user password") self.label = _("Remove user password")
@ -622,36 +628,6 @@ class VariableUrUnixMinUid(Variable):
value = "10000" value = "10000"
class VariableUrUnixUserShow(UnixUserHelper, UnixActionHelper, Variable):
"""
Группа
"""
type = "choiceedit"
opt = ["-U", "--user"]
metavalue = "USER"
def init(self):
self.label = _("login")
self.help = _("show user (support regular expressions)")
def get(self):
return "*"
def choice_exists(self):
try:
return ([("*", _("*"))]
+ self.ldap_user_list())
except LDAPConnectError as s:
raise VariableError(str(s))
def check_new(self, value):
if not value:
raise VariableError(_("Please specify user"))
if "*" not in value:
if not self.search_ldap_user_name(value):
raise VariableError(_("%s user not found") % value)
class VariableUrUnixUserCount(UnixUserHelper, UnixActionHelper, class VariableUrUnixUserCount(UnixUserHelper, UnixActionHelper,
ReadonlyVariable): ReadonlyVariable):
""" """
@ -669,7 +645,7 @@ class VariableClUnixUserAliases(ReadonlyVariable):
""" """
type = "table" type = "table"
value = [ value = [
('login', 'ur_unix_login'), # ('login', 'ur_unix_login'),
('uid', 'ur_unix_uid'), ('uid', 'ur_unix_uid'),
('gid', 'ur_unix_primary_group'), ('gid', 'ur_unix_primary_group'),
('comment', 'ur_unix_comment'), ('comment', 'ur_unix_comment'),
@ -707,3 +683,30 @@ class VariableClUnixCreateGroupSet(UnixGroupHelper, ReadonlyVariable):
if self.search_ldap_group("cn={0}".format(group_name)): if self.search_ldap_group("cn={0}".format(group_name)):
return "off" return "off"
return "on" return "on"
class VariableUrUnixUserShow(UnixUserHelper, UnixActionHelper, Variable):
"""
Фильтр на login
"""
type = "choiceedit"
opt = ["ur_unix_user_show"]
metavalue = "USER"
def init(self):
self.label = _("Login")
self.help = _("show user")
def get(self):
return ""
def choice_exists(self):
try:
return [("", "")] + self.ldap_user_list()
except LDAPConnectError as s:
raise VariableError(str(s))
def check_exists(self, value):
if value:
if not self.search_ldap_user_name(value):
raise VariableError(_("%s user not found") % value)

@ -88,8 +88,16 @@ class Wsdl(WsdlBase):
'server.sr_ldap_set', 'server.sr_ldap_set',
'server.sr_unix_set', 'server.sr_unix_set',
), ),
expert=('ld_unix_pw_generate_set',
'cl_verbose_set',),
hide=(), hide=(),
expert=(), custom_buttons=[
('but0', _("Remove"),
Unix.Method.Setup,
"button", None,
lambda Get: Get('server.sr_unix_set') == 'on'),
('but1', None, _("Next"), "button_next"),
]
), ),
], ],
'depends': [Ldap.Method.Setup], 'depends': [Ldap.Method.Setup],
@ -518,7 +526,7 @@ class Wsdl(WsdlBase):
# идентификатор метода # идентификатор метода
'method_name': Unix.Method.GroupShow, 'method_name': Unix.Method.GroupShow,
# категория метода # категория метода
'category': __('Server'), 'category': __('Server Accounts'),
# заголовок метода # заголовок метода
'title': __("Unix Groups"), 'title': __("Unix Groups"),
# иконка для графической консоли # иконка для графической консоли
@ -559,12 +567,11 @@ class Wsdl(WsdlBase):
'core.cl_page_count', 'core.cl_page_offset', 'core.cl_page_count', 'core.cl_page_offset',
), ),
expert=( expert=(
'cl_unix_group_fields',
'cl_unix_group_filter_name', 'cl_unix_group_filter_name',
'cl_unix_group_filter_id', 'cl_unix_group_filter_id',
'cl_unix_group_filter_comment', 'cl_unix_group_filter_comment',
'cl_unix_group_filter_users', 'cl_unix_group_filter_users',
'cl_unix_group_filter_primary', 'cl_unix_group_fields',
), ),
custom_buttons=[ custom_buttons=[
('but0', _("Add Group"), ('but0', _("Add Group"),
@ -585,7 +592,7 @@ class Wsdl(WsdlBase):
# идентификатор метода # идентификатор метода
'method_name': Unix.Method.UserShow, 'method_name': Unix.Method.UserShow,
# категория метода # категория метода
'category': __('Server'), 'category': __('Server Accounts'),
# заголовок метода # заголовок метода
'title': __("Unix Users"), 'title': __("Unix Users"),
# иконка для графической консоли # иконка для графической консоли
@ -626,7 +633,6 @@ class Wsdl(WsdlBase):
'core.cl_page_count', 'core.cl_page_offset', 'core.cl_page_count', 'core.cl_page_offset',
), ),
expert=( expert=(
'cl_unix_user_fields',
'cl_unix_user_filter_login', 'cl_unix_user_filter_login',
'cl_unix_user_filter_pw_set', 'cl_unix_user_filter_pw_set',
'cl_unix_user_filter_comment', 'cl_unix_user_filter_comment',
@ -637,6 +643,7 @@ class Wsdl(WsdlBase):
'cl_unix_user_filter_shell', 'cl_unix_user_filter_shell',
'cl_unix_user_filter_visible_set', 'cl_unix_user_filter_visible_set',
'cl_unix_user_filter_lock_set', 'cl_unix_user_filter_lock_set',
'cl_unix_user_fields',
), ),
custom_buttons=[ custom_buttons=[
('but0', _("Add User"), ('but0', _("Add User"),

Loading…
Cancel
Save