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

master-3.5
parent 796438c279
commit 319f9a2aec

@ -579,12 +579,15 @@ class Install(MethodsInterface):
"""
Обновить список локальных администраторов при установке
"""
aliases = {
'update': 'system_update',
}
install_admin = Admins(self.clVars, chroot=True)
install_admin.clear()
for k,v in self.clVars.select('install.cl_migrate_user',
'install.cl_migrate_admin',
install_cl_migrate_admin__ne=""):
install_admin[k] = v
install_admin[k] = aliases.get(v,v)
install_admin.save()
return True

@ -314,6 +314,11 @@ class VariableClMigrateData(UserHelper, TableVariable):
self.label = _("Migrating users")
def set(self, value):
value = [
[x[0], {'none':''}.get(x[1],x[1]),
x[2],x[3]]
for x in value
]
if len(value) == 1:
if len(value[0]) > 1 and value[0][0] == 'none':
return [[]]
@ -359,6 +364,7 @@ class VariableClMigrateAdmin(UserHelper, Variable):
"""
type = 'choice-list'
default_value = ""
aliases = {'system_update': 'update'}
def init(self):
self.label = _("Administrator")
@ -370,17 +376,18 @@ class VariableClMigrateAdmin(UserHelper, Variable):
("update", _("System update")),
]
def get_alias(self, value):
return self.aliases.get(value, value)
def get(self):
"""
Migrating users (users above 1000 uid)
"""
admins = Admins(self.parent)
return [admins[x] or self.default_value
return [self.get_alias(admins[x]) or self.default_value
for x in self.Get('cl_migrate_user')]
def set(self, value):
name_map = {'update':'system_update', 'none':''}
value = map(lambda x:name_map.get(x,x), value)
return map(lambda x: x if x else self.default_value, value)

Loading…
Cancel
Save