mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-01-15 14:47:24 +00:00
* [Update] 修改config * [Update] 移动存储设置到到terminal中 * [Update] 修改permission 查看 * [Update] pre merge * [Update] 录像存储 * [Update] 命令存储 * [Update] 添加存储测试可连接性 * [Update] 修改 meta 值的 key 为大写 * [Update] 修改 Terminal 相关 Storage 配置 * [Update] 删除之前获取录像/命令存储的代码 * [Update] 修改导入失败 * [Update] 迁移文件添加default存储 * [Update] 删除之前代码,添加help_text信息 * [Update] 删除之前代码 * [Update] 删除之前代码 * [Update] 抽象命令/录像存储 APIView * [Update] 抽象命令/录像存储 APIView 1 * [Update] 抽象命令/录像存储 DictField * [Update] 抽象命令/录像存储列表页面 * [Update] 修复CustomDictField的bug * [Update] RemoteApp 页面添加 hidden * [Update] 用户页面添加用户关联授权 * [Update] 修改存储测试可连接性 target * [Update] 修改配置 * [Update] 修改存储前端 Form 渲染逻辑 * [Update] 修改存储细节 * [Update] 统一存储类型到 const 文件 * [Update] 修改迁移文件及Model,创建默认存储 * [Update] 修改迁移文件及Model初始化默认数据 * [Update] 修改迁移文件 * [Update] 修改迁移文件 * [Update] 修改迁移文件 * [Update] 修改迁移文件 * [Update] 修改迁移文件 * [Update] 修改迁移文件 * [Update] 修改迁移文件 * [Update] 限制删除默认存储配置,只允许创建扩展的存储类型 * [Update] 修改ip字段长度 * [Update] 修改ip字段长度 * [Update] 修改一些css * [Update] 修改关联 * [Update] 添加操作日志定时清理 * [Update] 修改记录syslog的instance encoder * [Update] 忽略登录产生的操作日志 * [Update] 限制更新存储时不覆盖原有AK SK 等字段 * [Update] 修改迁移文件添加comment字段 * [Update] 修改迁移文件 * [Update] 添加 comment 字段 * [Update] 修改默认存储no -> null * [Update] 修改细节 * [Update] 更新翻译(存储配置 * [Update] 修改定时任务注册,修改系统用户资产、节点关系api * [Update] 添加监控磁盘任务 * [Update] 修改session * [Update] 拆分serializer * [Update] 还原setting原来的manager
122 lines
3.5 KiB
Python
122 lines
3.5 KiB
Python
# coding: utf-8
|
|
#
|
|
|
|
from django import forms
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from terminal.models import ReplayStorage, CommandStorage
|
|
|
|
|
|
__all__ = [
|
|
'ReplayStorageAzureForm', 'ReplayStorageOSSForm', 'ReplayStorageS3Form',
|
|
'CommandStorageTypeESForm',
|
|
]
|
|
|
|
|
|
class BaseStorageForm(forms.Form):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super(BaseStorageForm, self).__init__(*args, **kwargs)
|
|
self.fields['type'].widget.attrs['disabled'] = True
|
|
self.fields.move_to_end('comment')
|
|
|
|
|
|
class BaseReplayStorageForm(BaseStorageForm, forms.ModelForm):
|
|
|
|
class Meta:
|
|
model = ReplayStorage
|
|
fields = ['name', 'type', 'comment']
|
|
|
|
|
|
class BaseCommandStorageForm(BaseStorageForm, forms.ModelForm):
|
|
|
|
class Meta:
|
|
model = CommandStorage
|
|
fields = ['name', 'type', 'comment']
|
|
|
|
|
|
class ReplayStorageAzureForm(BaseReplayStorageForm):
|
|
azure_container_name = forms.CharField(
|
|
max_length=128, label=_('Container name'), required=False
|
|
)
|
|
azure_account_name = forms.CharField(
|
|
max_length=128, label=_('Account name'), required=False
|
|
)
|
|
azure_account_key = forms.CharField(
|
|
max_length=128, label=_('Account key'), required=False,
|
|
widget=forms.PasswordInput
|
|
)
|
|
azure_endpoint_suffix = forms.ChoiceField(
|
|
choices=(
|
|
('core.chinacloudapi.cn', 'core.chinacloudapi.cn'),
|
|
('core.windows.net', 'core.windows.net')
|
|
),
|
|
label=_('Endpoint suffix'), required=False,
|
|
)
|
|
|
|
|
|
class ReplayStorageOSSForm(BaseReplayStorageForm):
|
|
oss_bucket = forms.CharField(
|
|
max_length=128, label=_('Bucket'), required=False
|
|
)
|
|
oss_access_key = forms.CharField(
|
|
max_length=128, label=_('Access key'), required=False,
|
|
widget=forms.PasswordInput
|
|
)
|
|
oss_secret_key = forms.CharField(
|
|
max_length=128, label=_('Secret key'), required=False,
|
|
widget=forms.PasswordInput
|
|
)
|
|
oss_endpoint = forms.CharField(
|
|
max_length=128, label=_('Endpoint'), required=False,
|
|
help_text=_(
|
|
"""
|
|
OSS: http://{REGION_NAME}.aliyuncs.com <br>
|
|
Example: http://oss-cn-hangzhou.aliyuncs.com
|
|
"""
|
|
)
|
|
)
|
|
|
|
|
|
class ReplayStorageS3Form(BaseReplayStorageForm):
|
|
s3_bucket = forms.CharField(
|
|
max_length=128, label=_('Bucket'), required=False
|
|
)
|
|
s3_access_key = forms.CharField(
|
|
max_length=128, label=_('Access key'), required=False,
|
|
widget=forms.PasswordInput
|
|
)
|
|
s3_secret_key = forms.CharField(
|
|
max_length=128, label=_('Secret key'), required=False,
|
|
widget=forms.PasswordInput
|
|
)
|
|
s3_endpoint = forms.CharField(
|
|
max_length=128, label=_('Endpoint'), required=False,
|
|
help_text=_(
|
|
"""
|
|
S3: http://s3.{REGION_NAME}.amazonaws.com <br>
|
|
S3(China): http://s3.{REGION_NAME}.amazonaws.com.cn <br>
|
|
Example: http://s3.cn-north-1.amazonaws.com.cn
|
|
"""
|
|
)
|
|
)
|
|
|
|
|
|
class CommandStorageTypeESForm(BaseCommandStorageForm):
|
|
es_hosts = forms.CharField(
|
|
max_length=128, label=_('Hosts'), required=False,
|
|
help_text=_(
|
|
"""
|
|
Tips: If there are multiple hosts, separate them with a comma (,)
|
|
<br>
|
|
eg: http://www.jumpserver.a.com,http://www.jumpserver.b.com
|
|
"""
|
|
)
|
|
)
|
|
es_index = forms.CharField(
|
|
max_length=128, label=_('Index'), required=False
|
|
)
|
|
es_doc_type = forms.CharField(
|
|
max_length=128, label=_('Doc type'), required=False
|
|
)
|