mirror of https://github.com/jumpserver/jumpserver
perf: 修改 groups api
parent
cae9f03892
commit
d04ac09e82
|
@ -110,22 +110,10 @@ class BaseType(TextChoices):
|
||||||
def get_community_types(cls):
|
def get_community_types(cls):
|
||||||
return cls._get_choices_to_types()
|
return cls._get_choices_to_types()
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def get_lite_types(cls):
|
|
||||||
return []
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_choices(cls):
|
def get_choices(cls):
|
||||||
if not settings.XPACK_ENABLED:
|
if not settings.XPACK_ENABLED:
|
||||||
choices = [(tp.value, tp.label) for tp in cls.get_community_types()]
|
choices = [(tp.value, tp.label) for tp in cls.get_community_types()]
|
||||||
else:
|
else:
|
||||||
choices = cls.choices
|
choices = cls.choices
|
||||||
|
|
||||||
if not settings.LITE:
|
|
||||||
return choices
|
|
||||||
|
|
||||||
lite_choices = cls.get_lite_types()
|
|
||||||
if lite_choices:
|
|
||||||
lite_choices = [c.value for c in lite_choices]
|
|
||||||
choices = [c for c in choices if c[0] in lite_choices]
|
|
||||||
return choices
|
return choices
|
||||||
|
|
|
@ -107,10 +107,3 @@ class DatabaseTypes(BaseType):
|
||||||
return [
|
return [
|
||||||
cls.MYSQL, cls.MARIADB, cls.MONGODB, cls.REDIS
|
cls.MYSQL, cls.MARIADB, cls.MONGODB, cls.REDIS
|
||||||
]
|
]
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def get_lite_types(cls):
|
|
||||||
return [
|
|
||||||
cls.MYSQL, cls.MARIADB, cls.POSTGRESQL, cls.ORACLE,
|
|
||||||
cls.SQLSERVER, cls.DB2
|
|
||||||
]
|
|
||||||
|
|
|
@ -169,11 +169,11 @@ class AllTypes(ChoicesMixin):
|
||||||
(Category.HOST, HostTypes),
|
(Category.HOST, HostTypes),
|
||||||
(Category.DEVICE, DeviceTypes),
|
(Category.DEVICE, DeviceTypes),
|
||||||
(Category.DATABASE, DatabaseTypes),
|
(Category.DATABASE, DatabaseTypes),
|
||||||
|
(Category.WEB, WebTypes),
|
||||||
]
|
]
|
||||||
if not settings.LITE:
|
if settings.XPACK_ENABLED:
|
||||||
types.extend([
|
types.extend([
|
||||||
(Category.CLOUD, CloudTypes),
|
(Category.CLOUD, CloudTypes),
|
||||||
(Category.WEB, WebTypes),
|
|
||||||
(Category.GPT, GPTTypes),
|
(Category.GPT, GPTTypes),
|
||||||
(Category.CUSTOM, CustomTypes),
|
(Category.CUSTOM, CustomTypes),
|
||||||
])
|
])
|
||||||
|
|
|
@ -7761,7 +7761,7 @@ msgid "Org roles"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: users/serializers/user.py:90
|
#: users/serializers/user.py:90
|
||||||
msgid "Password option"
|
msgid "Password setting"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: users/serializers/user.py:92
|
#: users/serializers/user.py:92
|
||||||
|
|
|
@ -8070,7 +8070,7 @@ msgstr "組織ロール"
|
||||||
#: users/serializers/user.py:90
|
#: users/serializers/user.py:90
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
#| msgid "Password prompt"
|
#| msgid "Password prompt"
|
||||||
msgid "Password option"
|
msgid "Password setting"
|
||||||
msgstr "パスワードプロンプト"
|
msgstr "パスワードプロンプト"
|
||||||
|
|
||||||
#: users/serializers/user.py:92
|
#: users/serializers/user.py:92
|
||||||
|
|
|
@ -7883,7 +7883,7 @@ msgid "Org roles"
|
||||||
msgstr "组织角色"
|
msgstr "组织角色"
|
||||||
|
|
||||||
#: users/serializers/user.py:90
|
#: users/serializers/user.py:90
|
||||||
msgid "Password option"
|
msgid "Password setting"
|
||||||
msgstr "密码选项"
|
msgstr "密码选项"
|
||||||
|
|
||||||
#: users/serializers/user.py:92
|
#: users/serializers/user.py:92
|
||||||
|
|
|
@ -47,9 +47,10 @@
|
||||||
"ActiveUsers": "Active Users",
|
"ActiveUsers": "Active Users",
|
||||||
"Activity": "Activities",
|
"Activity": "Activities",
|
||||||
"Add": "Add",
|
"Add": "Add",
|
||||||
|
"AddAll": "Add all",
|
||||||
"AddAccount": "Add account",
|
"AddAccount": "Add account",
|
||||||
"AddAccountResult": "Second-Level Approver",
|
"AddAccountResult": "Second-Level Approver",
|
||||||
"AddAllMembersWarningMsg": "Are you sure you want to add all members?",
|
"AddAllMembersWarningMsg": "Are you sure add all user to this group ?",
|
||||||
"AddAsset": "Add Assets",
|
"AddAsset": "Add Assets",
|
||||||
"AddAssetToNode": "Add Assets to Node",
|
"AddAssetToNode": "Add Assets to Node",
|
||||||
"AddAssetToThisPermission": "Add Assets",
|
"AddAssetToThisPermission": "Add Assets",
|
||||||
|
@ -391,9 +392,9 @@
|
||||||
"Download": "Download",
|
"Download": "Download",
|
||||||
"DownloadCenter": "Download Center",
|
"DownloadCenter": "Download Center",
|
||||||
"DownloadFTPFileTip": "The current action does not record files, or the file size exceeds the threshold (default 100M), or it has not yet been saved to the corresponding storage",
|
"DownloadFTPFileTip": "The current action does not record files, or the file size exceeds the threshold (default 100M), or it has not yet been saved to the corresponding storage",
|
||||||
"DownloadImportTemplateMsg": "Download Creation Template",
|
"DownloadImportTemplateMsg": "Download creation template",
|
||||||
"DownloadReplay": "Download Recording",
|
"DownloadReplay": "Download Recording",
|
||||||
"DownloadUpdateTemplateMsg": "Download Update Template",
|
"DownloadUpdateTemplateMsg": "Download update template",
|
||||||
"DragUploadFileInfo": "Drag files here, or click here to upload",
|
"DragUploadFileInfo": "Drag files here, or click here to upload",
|
||||||
"DuplicateFileExists": "Uploading a file with the same name is not allowed, please delete the file with the same name",
|
"DuplicateFileExists": "Uploading a file with the same name is not allowed, please delete the file with the same name",
|
||||||
"Duration": "Duration",
|
"Duration": "Duration",
|
||||||
|
@ -440,7 +441,7 @@
|
||||||
"Expire": "Expired",
|
"Expire": "Expired",
|
||||||
"Expired": "Expiration Date",
|
"Expired": "Expiration Date",
|
||||||
"Export": "Export",
|
"Export": "Export",
|
||||||
"ExportAll": "Export All",
|
"ExportAll": "Export all",
|
||||||
"ExportOnlyFiltered": "Export filtered items",
|
"ExportOnlyFiltered": "Export filtered items",
|
||||||
"ExportOnlySelectedItems": "Export selected items",
|
"ExportOnlySelectedItems": "Export selected items",
|
||||||
"ExportRange": "Export Range",
|
"ExportRange": "Export Range",
|
||||||
|
@ -953,7 +954,7 @@
|
||||||
"Security": "Security",
|
"Security": "Security",
|
||||||
"Select": "Select",
|
"Select": "Select",
|
||||||
"SelectAdhoc": "Select Command",
|
"SelectAdhoc": "Select Command",
|
||||||
"SelectAll": "Select All",
|
"SelectAll": "Select all",
|
||||||
"SelectAtLeastOneAssetOrNodeErrMsg": "Select at Least One Asset or Node",
|
"SelectAtLeastOneAssetOrNodeErrMsg": "Select at Least One Asset or Node",
|
||||||
"SelectAttrs": "Select Attributes",
|
"SelectAttrs": "Select Attributes",
|
||||||
"SelectByAttr": "Attribute Filter",
|
"SelectByAttr": "Attribute Filter",
|
||||||
|
@ -1039,7 +1040,7 @@
|
||||||
"StrategyHelpTips": "Identify the unique attributes of assets (such as platforms) based on priority of strategies; when an asset's attribute (like nodes) can be configured to multiple, all Actions of the strategies will be executed.",
|
"StrategyHelpTips": "Identify the unique attributes of assets (such as platforms) based on priority of strategies; when an asset's attribute (like nodes) can be configured to multiple, all Actions of the strategies will be executed.",
|
||||||
"StrategyList": "Policy List",
|
"StrategyList": "Policy List",
|
||||||
"StrategyUpdate": "Update the Policy",
|
"StrategyUpdate": "Update the Policy",
|
||||||
"SuEnabled": "Enable su",
|
"SuEnabled": "Enable switch",
|
||||||
"SuFrom": "Switch From",
|
"SuFrom": "Switch From",
|
||||||
"Submit": "Submit",
|
"Submit": "Submit",
|
||||||
"Success": "Success",
|
"Success": "Success",
|
||||||
|
@ -1099,8 +1100,8 @@
|
||||||
"TerminateTaskSendSuccessMsg": "Task termination has been issued, please refresh and check later",
|
"TerminateTaskSendSuccessMsg": "Task termination has been issued, please refresh and check later",
|
||||||
"TermsAndConditions": "Terms and Conditions",
|
"TermsAndConditions": "Terms and Conditions",
|
||||||
"Test": "Test",
|
"Test": "Test",
|
||||||
"TestAccountConnective": "Test Account Connectivity",
|
"TestAccountConnective": "Test Connectivity",
|
||||||
"TestAssetsConnective": "Test Asset Connectivity",
|
"TestAssetsConnective": "Test Connectivity",
|
||||||
"TestConnection": "Test Connection",
|
"TestConnection": "Test Connection",
|
||||||
"TestGatewayHelpMessage": "If NAT port mapping is used, please set it to the real port listened to by SSH",
|
"TestGatewayHelpMessage": "If NAT port mapping is used, please set it to the real port listened to by SSH",
|
||||||
"TestGatewayTestConnection": "Test Connect to Gateway",
|
"TestGatewayTestConnection": "Test Connect to Gateway",
|
||||||
|
|
|
@ -13,6 +13,6 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='applet',
|
model_name='applet',
|
||||||
name='can_concurrent',
|
name='can_concurrent',
|
||||||
field=models.BooleanField(default=False, verbose_name='Can concurrent'),
|
field=models.BooleanField(default=False, verbose_name='Concurrent'),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
from rest_framework import status
|
|
||||||
from rest_framework.decorators import action
|
|
||||||
from rest_framework.response import Response
|
|
||||||
|
|
||||||
from orgs.mixins.api import OrgBulkModelViewSet
|
from orgs.mixins.api import OrgBulkModelViewSet
|
||||||
from ..models import UserGroup, User
|
from ..models import UserGroup
|
||||||
from ..serializers import UserGroupSerializer, UserGroupListSerializer
|
from ..serializers import UserGroupSerializer, UserGroupListSerializer
|
||||||
|
|
||||||
__all__ = ['UserGroupViewSet']
|
__all__ = ['UserGroupViewSet']
|
||||||
|
@ -20,13 +17,3 @@ class UserGroupViewSet(OrgBulkModelViewSet):
|
||||||
'list': UserGroupListSerializer,
|
'list': UserGroupListSerializer,
|
||||||
}
|
}
|
||||||
ordering = ('name',)
|
ordering = ('name',)
|
||||||
rbac_perms = (
|
|
||||||
("add_all_users", "users.add_usergroup"),
|
|
||||||
)
|
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, url_path='add-all-users')
|
|
||||||
def add_all_users(self, request, *args, **kwargs):
|
|
||||||
instance = self.get_object()
|
|
||||||
users = User.get_org_users().exclude(groups__id=instance.id)
|
|
||||||
instance.users.add(*users)
|
|
||||||
return Response(status=status.HTTP_200_OK)
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ class UserSerializer(RolesSerializerMixin, ResourceLabelsMixin, CommonBulkModelS
|
||||||
default=PasswordStrategy.email,
|
default=PasswordStrategy.email,
|
||||||
allow_null=True,
|
allow_null=True,
|
||||||
required=False,
|
required=False,
|
||||||
label=_("Password option"),
|
label=_("Password setting"),
|
||||||
)
|
)
|
||||||
mfa_enabled = serializers.BooleanField(read_only=True, label=_("MFA enabled"))
|
mfa_enabled = serializers.BooleanField(read_only=True, label=_("MFA enabled"))
|
||||||
mfa_force_enabled = serializers.BooleanField(
|
mfa_force_enabled = serializers.BooleanField(
|
||||||
|
|
Loading…
Reference in New Issue