parent
00757899b9
commit
2e8c4fb602
@ -0,0 +1,64 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action, Tasks
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError
|
||||||
|
from calculate.server.variables.action import Actions
|
||||||
|
from ..unix import UnixError, Unix
|
||||||
|
from calculate.ldap.ldap import LdapError
|
||||||
|
from calculate.ldap.utils.cl_ldap_setup import MetaTasks
|
||||||
|
|
||||||
|
from calculate.ldap.utils.cl_ldap_setup import ClLdapSetupAction
|
||||||
|
|
||||||
|
from calculate.server.server import ServerError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_unix3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClUnixGroupaddAction(Action):
|
||||||
|
"""
|
||||||
|
Действие обновление конфигурационных файлов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,
|
||||||
|
TemplatesError,
|
||||||
|
VariableError,
|
||||||
|
ServerError,
|
||||||
|
UnixError,
|
||||||
|
LdapError)
|
||||||
|
|
||||||
|
successMessage = __("Group {ur_unix_group_name} added in Unix service!")
|
||||||
|
failedMessage = __("Failed to add {ur_unix_group_name} in Unix server!")
|
||||||
|
interruptMessage = __("Adding of new group manually interrupted")
|
||||||
|
|
||||||
|
stop_tasks = [
|
||||||
|
]
|
||||||
|
|
||||||
|
meta_tasks = MetaTasks("Unix")
|
||||||
|
|
||||||
|
# список задач для действия
|
||||||
|
tasks = [
|
||||||
|
{'name': 'apply_ldif',
|
||||||
|
'tasks': meta_tasks.ldif_task("unix.ld_unix_dn,unix.ld_unix_pw",
|
||||||
|
Actions.Setup)
|
||||||
|
},
|
||||||
|
]
|
@ -0,0 +1,66 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action, Tasks
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError
|
||||||
|
from calculate.server.variables.action import Actions
|
||||||
|
from ..unix import UnixError, Unix
|
||||||
|
from calculate.ldap.ldap import LdapError
|
||||||
|
from calculate.ldap.utils.cl_ldap_setup import MetaTasks
|
||||||
|
|
||||||
|
from calculate.server.server import ServerError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_unix3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClUnixGroupdelAction(Action):
|
||||||
|
"""
|
||||||
|
Действие обновление конфигурационных файлов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,
|
||||||
|
TemplatesError,
|
||||||
|
VariableError,
|
||||||
|
ServerError,
|
||||||
|
UnixError,
|
||||||
|
LdapError)
|
||||||
|
|
||||||
|
successMessage = __("Group {ur_unix_group_name} deleted from Unix service!")
|
||||||
|
failedMessage = __(
|
||||||
|
"Failed to delete {ur_unix_group_name} from Unix server!")
|
||||||
|
interruptMessage = __("Deleting of group manually interrupted")
|
||||||
|
|
||||||
|
stop_tasks = [
|
||||||
|
]
|
||||||
|
|
||||||
|
meta_tasks = MetaTasks("Unix")
|
||||||
|
|
||||||
|
# список задач для действия
|
||||||
|
tasks = [
|
||||||
|
{'name': 'remove_group_users',
|
||||||
|
'message': _("Users {unix.ur_unix_group_users} removed "
|
||||||
|
"from group {unix.ur_unix_group_name}"),
|
||||||
|
},
|
||||||
|
{'name': 'remove_group',
|
||||||
|
'method': 'Unix.remove_group(unix.ur_unix_group_name)'
|
||||||
|
},
|
||||||
|
]
|
@ -0,0 +1,95 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action, Tasks
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError
|
||||||
|
from calculate.server.variables.action import Actions
|
||||||
|
from ..unix import UnixError, Unix
|
||||||
|
from calculate.ldap.ldap import LdapError
|
||||||
|
from calculate.ldap.utils.cl_ldap_setup import MetaTasks
|
||||||
|
|
||||||
|
from calculate.server.server import ServerError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_unix3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClUnixGroupmodAction(Action):
|
||||||
|
"""
|
||||||
|
Действие обновление конфигурационных файлов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,
|
||||||
|
TemplatesError,
|
||||||
|
VariableError,
|
||||||
|
ServerError,
|
||||||
|
UnixError,
|
||||||
|
LdapError)
|
||||||
|
|
||||||
|
successMessage = __("Group {ur_unix_group_name} modified in Unix service!")
|
||||||
|
failedMessage = __("Failed to modify {ur_unix_group_name} in Unix server!")
|
||||||
|
interruptMessage = __("Modifing of group manually interrupted")
|
||||||
|
|
||||||
|
stop_tasks = [
|
||||||
|
]
|
||||||
|
|
||||||
|
meta_tasks = MetaTasks("Unix")
|
||||||
|
|
||||||
|
# список задач для действия
|
||||||
|
tasks = [
|
||||||
|
{'name': 'remove_users',
|
||||||
|
'message': _("Users {unix.ur_unix_group_users_del} removed "
|
||||||
|
"from group {unix.ur_unix_group_name}"),
|
||||||
|
'method': 'Unix.remove_users_from_group(unix.ur_unix_group_users_del,'
|
||||||
|
'unix.ur_unix_group_name_exists)',
|
||||||
|
'condition': lambda Get: Get('unix.ur_unix_group_users_del')
|
||||||
|
},
|
||||||
|
{'name': 'append_users',
|
||||||
|
'message': _("Users {unix.ur_unix_group_users_add} added "
|
||||||
|
"to group {unix.ur_unix_group_name}"),
|
||||||
|
'method': 'Unix.add_users_in_group(unix.ur_unix_group_users_add,'
|
||||||
|
'unix.ur_unix_group_name_exists)',
|
||||||
|
'condition': lambda Get: Get('unix.ur_unix_group_users_add')
|
||||||
|
},
|
||||||
|
{'name': 'rename_group',
|
||||||
|
'message': _("Rename group {unix.ur_unix_group_name} to "
|
||||||
|
"{unix.ur_unix_group_newname}"),
|
||||||
|
'method': 'Unix.rename_group(unix.ur_unix_group_name,'
|
||||||
|
'unix.ur_unix_group_newname)',
|
||||||
|
'condition': lambda Get: Get('unix.ur_unix_group_newname')
|
||||||
|
},
|
||||||
|
{'name': 'change_comment',
|
||||||
|
'message': _("Changed comment for group {unix.ur_unix_group_name} to "
|
||||||
|
"{unix.ur_unix_group_comment}"),
|
||||||
|
'method': 'Unix.update_group_comment(unix.ur_unix_group_name,'
|
||||||
|
'unix.ur_unix_group_comment)',
|
||||||
|
'condition': lambda Get: Get('unix.ur_unix_group_comment') != Get(
|
||||||
|
'unix.ur_unix_group_comment_exists')
|
||||||
|
},
|
||||||
|
{'name': 'group_change_id',
|
||||||
|
'message': _("Changes ID for group {unix.ur_unix_group_name} "
|
||||||
|
"to {unix.ur_unix_group_id}"),
|
||||||
|
'method': 'Unix.update_group_id(unix.ur_unix_group_name,'
|
||||||
|
'unix.ur_unix_group_id,unix.ur_unix_group_id_exists)',
|
||||||
|
'condition': lambda Get: (Get('unix.ur_unix_group_id') != Get(
|
||||||
|
'unix.ur_unix_group_id_exists'))
|
||||||
|
},
|
||||||
|
]
|
@ -0,0 +1,64 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action, Tasks
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError
|
||||||
|
from calculate.server.variables.action import Actions
|
||||||
|
from ..unix import UnixError, Unix
|
||||||
|
from calculate.ldap.ldap import LdapError
|
||||||
|
from calculate.ldap.utils.cl_ldap_setup import MetaTasks
|
||||||
|
|
||||||
|
from calculate.server.server import ServerError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_unix3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClUnixGroupshowAction(Action):
|
||||||
|
"""
|
||||||
|
Действие обновление конфигурационных файлов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,
|
||||||
|
TemplatesError,
|
||||||
|
VariableError,
|
||||||
|
ServerError,
|
||||||
|
UnixError,
|
||||||
|
LdapError)
|
||||||
|
|
||||||
|
successMessage = None
|
||||||
|
failedMessage = None
|
||||||
|
interruptMessage = __("Viewing manually interrupted")
|
||||||
|
|
||||||
|
meta_tasks = MetaTasks("Unix")
|
||||||
|
|
||||||
|
# список задач для действия
|
||||||
|
tasks = [
|
||||||
|
{'name': 'view_groups',
|
||||||
|
'method': 'Unix.show_groups(unix.cl_unix_group_show_fields,'
|
||||||
|
'core.cl_page_count,core.cl_page_offset)',
|
||||||
|
'condition': lambda Get: Get('ur_unix_group_show') == "all"
|
||||||
|
},
|
||||||
|
{'name': 'view_group',
|
||||||
|
'method': 'Unix.show_group(ur_unix_group_show)',
|
||||||
|
'condition': lambda Get: Get('ur_unix_group_show') != "all"
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,62 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action, Tasks
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError
|
||||||
|
from calculate.server.variables.action import Actions
|
||||||
|
from ..unix import UnixError, Unix
|
||||||
|
from calculate.ldap.ldap import LdapError
|
||||||
|
from calculate.ldap.utils.cl_ldap_setup import MetaTasks
|
||||||
|
|
||||||
|
from calculate.server.server import ServerError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_unix3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClUnixPasswdAction(Action):
|
||||||
|
"""
|
||||||
|
Действие обновление конфигурационных файлов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,
|
||||||
|
TemplatesError,
|
||||||
|
VariableError,
|
||||||
|
ServerError,
|
||||||
|
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")
|
||||||
|
|
||||||
|
stop_tasks = [
|
||||||
|
]
|
||||||
|
|
||||||
|
meta_tasks = MetaTasks("Unix")
|
||||||
|
|
||||||
|
# список задач для действия
|
||||||
|
tasks = [
|
||||||
|
{'name': 'user_change',
|
||||||
|
'method': 'Unix.modify_user(ur_unix_login,ur_unix_hash,'
|
||||||
|
'None,None,None,ur_unix_lock_set, None)'
|
||||||
|
},
|
||||||
|
]
|
@ -0,0 +1,74 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action, Tasks
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError
|
||||||
|
from calculate.server.variables.action import Actions
|
||||||
|
from ..unix import UnixError, Unix
|
||||||
|
from calculate.ldap.ldap import LdapError
|
||||||
|
from calculate.ldap.utils.cl_ldap_setup import MetaTasks
|
||||||
|
|
||||||
|
from calculate.ldap.utils.cl_ldap_setup import ClLdapSetupAction
|
||||||
|
|
||||||
|
from calculate.server.server import ServerError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_unix3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClUnixUseraddAction(Action):
|
||||||
|
"""
|
||||||
|
Действие обновление конфигурационных файлов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,
|
||||||
|
TemplatesError,
|
||||||
|
VariableError,
|
||||||
|
ServerError,
|
||||||
|
UnixError,
|
||||||
|
LdapError)
|
||||||
|
|
||||||
|
successMessage = __("User {ur_unix_login} added in Unix service!")
|
||||||
|
failedMessage = __("Failed to add {ur_unix_login} in Unix server!")
|
||||||
|
interruptMessage = __("Adding of new user manually interrupted")
|
||||||
|
|
||||||
|
stop_tasks = [
|
||||||
|
]
|
||||||
|
|
||||||
|
meta_tasks = MetaTasks("Unix")
|
||||||
|
|
||||||
|
# список задач для действия
|
||||||
|
tasks = [
|
||||||
|
{'name': 'apply_ldif',
|
||||||
|
'tasks': meta_tasks.ldif_task("unix.ld_unix_dn,unix.ld_unix_pw",
|
||||||
|
Actions.Setup)
|
||||||
|
},
|
||||||
|
{'name': 'user_groups',
|
||||||
|
'method': 'Unix.add_user_in_groups(ur_unix_login,ur_unix_groups)',
|
||||||
|
'condition': lambda Get: Get('ur_unix_groups')
|
||||||
|
},
|
||||||
|
{'name': 'create_homedir',
|
||||||
|
'message': _("Create user home directory {unix.ur_unix_home_path}"),
|
||||||
|
'method': 'Unix.create_home_directory(unix.ur_unix_home_path,'
|
||||||
|
'unix.ur_unix_uid,unix.ur_unix_gid,ur_unix_skel)',
|
||||||
|
'condition': lambda Get: Get('unix.ur_unix_create_home_set') == 'on'
|
||||||
|
},
|
||||||
|
]
|
@ -0,0 +1,73 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action, Tasks
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError
|
||||||
|
from calculate.server.variables.action import Actions
|
||||||
|
from ..unix import UnixError, Unix
|
||||||
|
from calculate.ldap.ldap import LdapError
|
||||||
|
from calculate.ldap.utils.cl_ldap_setup import MetaTasks
|
||||||
|
|
||||||
|
from calculate.server.server import ServerError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_unix3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClUnixUserdelAction(Action):
|
||||||
|
"""
|
||||||
|
Действие обновление конфигурационных файлов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,
|
||||||
|
TemplatesError,
|
||||||
|
VariableError,
|
||||||
|
ServerError,
|
||||||
|
UnixError,
|
||||||
|
LdapError)
|
||||||
|
|
||||||
|
successMessage = __("User {ur_unix_login} deleted from Unix service!")
|
||||||
|
failedMessage = __(
|
||||||
|
"Failed to delete {ur_unix_login} from Unix server!")
|
||||||
|
interruptMessage = __("Deleting of user manually interrupted")
|
||||||
|
|
||||||
|
stop_tasks = [
|
||||||
|
]
|
||||||
|
|
||||||
|
meta_tasks = MetaTasks("Unix")
|
||||||
|
|
||||||
|
# список задач для действия
|
||||||
|
tasks = [
|
||||||
|
{'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,'
|
||||||
|
'unix.ur_unix_groups)',
|
||||||
|
'condition': lambda Get: Get('unix.ur_unix_groups')
|
||||||
|
},
|
||||||
|
{'name': 'remove_primary_group',
|
||||||
|
'method': 'Unix.try_remove_primary_group(unix.ur_unix_login,'
|
||||||
|
'unix.ur_unix_gid)'
|
||||||
|
},
|
||||||
|
{'name': 'remove_user',
|
||||||
|
'method': 'Unix.remove_user(unix.ur_unix_login)'
|
||||||
|
},
|
||||||
|
]
|
@ -0,0 +1,92 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action, Tasks
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError
|
||||||
|
from calculate.server.variables.action import Actions
|
||||||
|
from ..unix import UnixError, Unix
|
||||||
|
from calculate.ldap.ldap import LdapError
|
||||||
|
from calculate.ldap.utils.cl_ldap_setup import MetaTasks
|
||||||
|
|
||||||
|
from calculate.server.server import ServerError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_unix3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClUnixUsermodAction(Action):
|
||||||
|
"""
|
||||||
|
Действие обновление конфигурационных файлов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,
|
||||||
|
TemplatesError,
|
||||||
|
VariableError,
|
||||||
|
ServerError,
|
||||||
|
UnixError,
|
||||||
|
LdapError)
|
||||||
|
|
||||||
|
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 = [
|
||||||
|
]
|
||||||
|
|
||||||
|
meta_tasks = MetaTasks("Unix")
|
||||||
|
|
||||||
|
# список задач для действия
|
||||||
|
tasks = [
|
||||||
|
{'name': 'user_change',
|
||||||
|
'method': 'Unix.modify_user(ur_unix_login,ur_unix_pw,ur_unix_gid,'
|
||||||
|
'ur_unix_shell,ur_unix_visible_set,ur_unix_lock_set,'
|
||||||
|
'ur_unix_comment)',
|
||||||
|
},
|
||||||
|
{'name': 'remove_groups',
|
||||||
|
'message': _("User {unix.ur_unix_login} removed from "
|
||||||
|
"groups {unix.ur_unix_groups_del}"),
|
||||||
|
'method': 'Unix.remove_user_from_groups(unix.ur_unix_login,'
|
||||||
|
'unix.ur_unix_groups_del)',
|
||||||
|
'condition': lambda Get: Get('unix.ur_unix_groups_del')
|
||||||
|
},
|
||||||
|
{'name': 'append_groups',
|
||||||
|
'message': _("User {unix.ur_unix_login} added "
|
||||||
|
"to groups {unix.ur_unix_groups_add}"),
|
||||||
|
'method': 'Unix.add_user_in_groups(unix.ur_unix_login,'
|
||||||
|
'unix.ur_unix_groups_add)',
|
||||||
|
'condition': lambda Get: Get('unix.ur_unix_groups_add')
|
||||||
|
},
|
||||||
|
{'name': 'move_homedir',
|
||||||
|
'message': _("User home directory {unix.ur_unix_home_path_exists} "
|
||||||
|
"moved to {unix.ur_unix_home_path}"),
|
||||||
|
'method': 'Unix.move_home_directory(unix.ur_unix_home_path_exists,'
|
||||||
|
'unix.ur_unix_home_path)',
|
||||||
|
'condition': lambda Get: Get('unix.ur_unix_home_path_move') == 'on'
|
||||||
|
},
|
||||||
|
# {'name': 'apply_ldif',
|
||||||
|
# 'tasks': meta_tasks.ldif_task("unix.ld_unix_dn,unix.ld_unix_pw",
|
||||||
|
# Actions.Setup)
|
||||||
|
# },
|
||||||
|
# {'name': 'user_groups',
|
||||||
|
# 'method': 'Unix.add_user_in_groups(ur_unix_login,ur_unix_groups)',
|
||||||
|
# 'condition': lambda Get: Get('ur_unix_groups')
|
||||||
|
# },
|
||||||
|
]
|
@ -0,0 +1,64 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action, Tasks
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError
|
||||||
|
from calculate.server.variables.action import Actions
|
||||||
|
from ..unix import UnixError, Unix
|
||||||
|
from calculate.ldap.ldap import LdapError
|
||||||
|
from calculate.ldap.utils.cl_ldap_setup import MetaTasks
|
||||||
|
|
||||||
|
from calculate.server.server import ServerError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_unix3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClUnixUsershowAction(Action):
|
||||||
|
"""
|
||||||
|
Действие обновление конфигурационных файлов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,
|
||||||
|
TemplatesError,
|
||||||
|
VariableError,
|
||||||
|
ServerError,
|
||||||
|
UnixError,
|
||||||
|
LdapError)
|
||||||
|
|
||||||
|
successMessage = None
|
||||||
|
failedMessage = None
|
||||||
|
interruptMessage = __("Viewing manually interrupted")
|
||||||
|
|
||||||
|
meta_tasks = MetaTasks("Unix")
|
||||||
|
|
||||||
|
# список задач для действия
|
||||||
|
tasks = [
|
||||||
|
{'name': 'view_users',
|
||||||
|
'method': 'Unix.show_users(unix.cl_unix_user_show_fields,'
|
||||||
|
'core.cl_page_count,core.cl_page_offset)',
|
||||||
|
'condition': lambda Get: Get('ur_unix_user_show') == "all"
|
||||||
|
},
|
||||||
|
{'name': 'view_user',
|
||||||
|
'method': 'Unix.show_user(ur_unix_user_show)',
|
||||||
|
'condition': lambda Get: Get('ur_unix_user_show') != "all"
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,174 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.lib.datavars import (VariableInterface, VariableError)
|
||||||
|
from calculate.unix.unix import UnixGroups, UnixUsers
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate)
|
||||||
|
|
||||||
|
setLocalTranslate('cl_unix3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class Actions(object):
|
||||||
|
UserAdd = "useradd"
|
||||||
|
UserMod = "usermod"
|
||||||
|
UserDel = "userdel"
|
||||||
|
GroupAdd = "groupadd"
|
||||||
|
GroupMod = "groupmod"
|
||||||
|
GroupDel = "groupdel"
|
||||||
|
Passwd = "passwd"
|
||||||
|
Setup = "setup"
|
||||||
|
GroupShow = "groupshow"
|
||||||
|
UserShow = "usershow"
|
||||||
|
|
||||||
|
UserExists = (UserMod, UserDel, Passwd)
|
||||||
|
GroupExists = (GroupMod, GroupDel)
|
||||||
|
All = (
|
||||||
|
UserAdd, UserMod, UserDel, GroupAdd, GroupMod, GroupDel, Setup, Passwd)
|
||||||
|
New = (UserAdd, GroupAdd)
|
||||||
|
Exists = (Passwd, UserMod, UserDel, GroupMod, GroupDel, UserShow, GroupShow)
|
||||||
|
|
||||||
|
|
||||||
|
class ExistsUserHelper(VariableInterface):
|
||||||
|
attribute = ""
|
||||||
|
|
||||||
|
def get_exists(self):
|
||||||
|
user = self.Get('ur_unix_user_object')
|
||||||
|
if user:
|
||||||
|
val = getattr(user, self.attribute)
|
||||||
|
if type(val) == bool:
|
||||||
|
return "on" if val else "off"
|
||||||
|
else:
|
||||||
|
return val
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
class UnixGroupHelper(VariableInterface, UnixGroups):
|
||||||
|
exception = VariableError
|
||||||
|
|
||||||
|
@property
|
||||||
|
def ldap_connect(self):
|
||||||
|
return self.Get('ldap.cl_ldap_connect')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def groups_dn(self):
|
||||||
|
return self.Get('ld_unix_groups_dn')
|
||||||
|
|
||||||
|
|
||||||
|
class UnixUserHelper(VariableInterface, UnixUsers):
|
||||||
|
exception = VariableError
|
||||||
|
|
||||||
|
@property
|
||||||
|
def ldap_connect(self):
|
||||||
|
return self.Get('ldap.cl_ldap_connect')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def users_dn(self):
|
||||||
|
return self.Get('ld_unix_users_dn')
|
||||||
|
|
||||||
|
|
||||||
|
class UnixUserPropertyHelper(VariableInterface):
|
||||||
|
"""
|
||||||
|
Получение атрибутов текущего пользователя
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class UnixActionHelper(VariableInterface):
|
||||||
|
"""
|
||||||
|
Разделение на методы в зависимости от действия
|
||||||
|
"""
|
||||||
|
fallback = ""
|
||||||
|
|
||||||
|
def get_new(self):
|
||||||
|
if "list" in self.type:
|
||||||
|
return []
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def get_exists(self):
|
||||||
|
if "list" in self.type:
|
||||||
|
return []
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def check_new(self, value):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def check_exists(self, value):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def choice_new(self):
|
||||||
|
return []
|
||||||
|
|
||||||
|
def choice_exists(self):
|
||||||
|
return []
|
||||||
|
|
||||||
|
def _new(self, value):
|
||||||
|
return value in Actions.New
|
||||||
|
|
||||||
|
def _exists(self, value):
|
||||||
|
return value in Actions.Exists
|
||||||
|
|
||||||
|
def get(self):
|
||||||
|
unix_action = self.Get('unix.cl_unix_action')
|
||||||
|
if self._new(unix_action):
|
||||||
|
return self.get_new()
|
||||||
|
elif self._exists(unix_action):
|
||||||
|
return self.get_exists()
|
||||||
|
return self.fallback
|
||||||
|
|
||||||
|
def check(self, value):
|
||||||
|
unix_action = self.Get('unix.cl_unix_action')
|
||||||
|
if self._new(unix_action):
|
||||||
|
return self.check_new(value)
|
||||||
|
elif self._exists(unix_action):
|
||||||
|
return self.check_exists(value)
|
||||||
|
|
||||||
|
def choice(self):
|
||||||
|
unix_action = self.Get('unix.cl_unix_action')
|
||||||
|
if self._new(unix_action):
|
||||||
|
return self.choice_new()
|
||||||
|
elif self._exists(unix_action):
|
||||||
|
return self.choice_exists()
|
||||||
|
|
||||||
|
class FieldsHelper(VariableInterface):
|
||||||
|
type = "choice-list"
|
||||||
|
element = "selecttable"
|
||||||
|
opt = ["--fields"]
|
||||||
|
metavalue = "FIELDS"
|
||||||
|
alias_variable = ""
|
||||||
|
|
||||||
|
def init(self):
|
||||||
|
self.label = _("Fields")
|
||||||
|
self.help = _("fields for display")
|
||||||
|
|
||||||
|
def choice(self):
|
||||||
|
data = self.Get(self.alias_variable)
|
||||||
|
return [(x, self.parent.getInfo(y).label) for x, y in data]
|
||||||
|
|
||||||
|
def get(self):
|
||||||
|
return [x for x, y in self.Get(self.alias_variable)]
|
||||||
|
|
||||||
|
|
||||||
|
class ShowFieldsHelper(VariableInterface):
|
||||||
|
type = "list"
|
||||||
|
alias_variable = ""
|
||||||
|
source_variable = ""
|
||||||
|
|
||||||
|
def get(self):
|
||||||
|
mapping = dict(self.Get(self.alias_variable))
|
||||||
|
return [mapping[x] for x in self.Get(self.source_variable)]
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue