mirror of https://github.com/jumpserver/jumpserver
commit
3a93aeb155
|
@ -16,7 +16,7 @@ from orgs.mixins import generics
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'AutomationAssetsListApi', 'AutomationRemoveAssetApi',
|
'AutomationAssetsListApi', 'AutomationRemoveAssetApi',
|
||||||
'AutomationAddAssetApi', 'AutomationNodeAddRemoveApi',
|
'AutomationAddAssetApi', 'AutomationNodeAddRemoveApi',
|
||||||
'AutomationExecutionViewSet',
|
'AutomationExecutionViewSet', 'RecordListMixin'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ from accounts.filters import ChangeSecretRecordFilterSet
|
||||||
from accounts.models import ChangeSecretAutomation, ChangeSecretRecord
|
from accounts.models import ChangeSecretAutomation, ChangeSecretRecord
|
||||||
from accounts.tasks import execute_automation_record_task
|
from accounts.tasks import execute_automation_record_task
|
||||||
from authentication.permissions import UserConfirmation, ConfirmType
|
from authentication.permissions import UserConfirmation, ConfirmType
|
||||||
|
from common.permissions import IsValidLicense
|
||||||
from orgs.mixins.api import OrgBulkModelViewSet, OrgGenericViewSet
|
from orgs.mixins.api import OrgBulkModelViewSet, OrgGenericViewSet
|
||||||
from rbac.permissions import RBACPermission
|
from rbac.permissions import RBACPermission
|
||||||
from .base import (
|
from .base import (
|
||||||
|
@ -28,6 +29,7 @@ __all__ = [
|
||||||
|
|
||||||
class ChangeSecretAutomationViewSet(OrgBulkModelViewSet):
|
class ChangeSecretAutomationViewSet(OrgBulkModelViewSet):
|
||||||
model = ChangeSecretAutomation
|
model = ChangeSecretAutomation
|
||||||
|
permission_classes = [RBACPermission, IsValidLicense]
|
||||||
filterset_fields = ('name', 'secret_type', 'secret_strategy')
|
filterset_fields = ('name', 'secret_type', 'secret_strategy')
|
||||||
search_fields = filterset_fields
|
search_fields = filterset_fields
|
||||||
serializer_class = serializers.ChangeSecretAutomationSerializer
|
serializer_class = serializers.ChangeSecretAutomationSerializer
|
||||||
|
@ -35,6 +37,7 @@ class ChangeSecretAutomationViewSet(OrgBulkModelViewSet):
|
||||||
|
|
||||||
class ChangeSecretRecordViewSet(RecordListMixin, mixins.ListModelMixin, OrgGenericViewSet):
|
class ChangeSecretRecordViewSet(RecordListMixin, mixins.ListModelMixin, OrgGenericViewSet):
|
||||||
filterset_class = ChangeSecretRecordFilterSet
|
filterset_class = ChangeSecretRecordFilterSet
|
||||||
|
permission_classes = [RBACPermission, IsValidLicense]
|
||||||
search_fields = ('asset__address', 'account__username')
|
search_fields = ('asset__address', 'account__username')
|
||||||
ordering_fields = ('date_finished',)
|
ordering_fields = ('date_finished',)
|
||||||
tp = AutomationTypes.change_secret
|
tp = AutomationTypes.change_secret
|
||||||
|
@ -125,7 +128,7 @@ class ChangSecretExecutionViewSet(AutomationExecutionViewSet):
|
||||||
("create", "accounts.add_changesecretexecution"),
|
("create", "accounts.add_changesecretexecution"),
|
||||||
("report", "accounts.view_changesecretexecution"),
|
("report", "accounts.view_changesecretexecution"),
|
||||||
)
|
)
|
||||||
|
permission_classes = [RBACPermission, IsValidLicense]
|
||||||
tp = AutomationTypes.change_secret
|
tp = AutomationTypes.change_secret
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
|
|
|
@ -11,9 +11,11 @@ from accounts.const import AutomationTypes, ChangeSecretRecordStatusChoice
|
||||||
from accounts.models import ChangeSecretAutomation, AutomationExecution, ChangeSecretRecord
|
from accounts.models import ChangeSecretAutomation, AutomationExecution, ChangeSecretRecord
|
||||||
from assets.models import Node, Asset
|
from assets.models import Node, Asset
|
||||||
from common.const import Status
|
from common.const import Status
|
||||||
|
from common.permissions import IsValidLicense
|
||||||
from common.utils import lazyproperty
|
from common.utils import lazyproperty
|
||||||
from common.utils.timezone import local_zero_hour, local_now
|
from common.utils.timezone import local_zero_hour, local_now
|
||||||
from ops.celery import app
|
from ops.celery import app
|
||||||
|
from rbac.permissions import RBACPermission
|
||||||
|
|
||||||
__all__ = ['ChangeSecretDashboardApi']
|
__all__ = ['ChangeSecretDashboardApi']
|
||||||
|
|
||||||
|
@ -23,7 +25,7 @@ class ChangeSecretDashboardApi(APIView):
|
||||||
rbac_perms = {
|
rbac_perms = {
|
||||||
'GET': 'accounts.view_changesecretautomation',
|
'GET': 'accounts.view_changesecretautomation',
|
||||||
}
|
}
|
||||||
|
permission_classes = [RBACPermission, IsValidLicense]
|
||||||
tp = AutomationTypes.change_secret
|
tp = AutomationTypes.change_secret
|
||||||
task_name = 'accounts.tasks.automation.execute_account_automation_task'
|
task_name = 'accounts.tasks.automation.execute_account_automation_task'
|
||||||
ongoing_change_secret_cache_key = "ongoing_change_secret_cache_key"
|
ongoing_change_secret_cache_key = "ongoing_change_secret_cache_key"
|
||||||
|
|
|
@ -18,9 +18,13 @@ from accounts.models import (
|
||||||
)
|
)
|
||||||
from assets.models import Asset
|
from assets.models import Asset
|
||||||
from common.api import JMSModelViewSet
|
from common.api import JMSModelViewSet
|
||||||
|
from common.permissions import IsValidLicense
|
||||||
from common.utils import many_get
|
from common.utils import many_get
|
||||||
from orgs.mixins.api import OrgBulkModelViewSet
|
from orgs.mixins.api import OrgBulkModelViewSet
|
||||||
|
from rbac.permissions import RBACPermission
|
||||||
from .base import AutomationExecutionViewSet
|
from .base import AutomationExecutionViewSet
|
||||||
|
from ...filters import NodeFilterBackend
|
||||||
|
from ...risk_handlers import RiskHandler
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"CheckAccountAutomationViewSet",
|
"CheckAccountAutomationViewSet",
|
||||||
|
@ -29,14 +33,12 @@ __all__ = [
|
||||||
"CheckAccountEngineViewSet",
|
"CheckAccountEngineViewSet",
|
||||||
]
|
]
|
||||||
|
|
||||||
from ...filters import NodeFilterBackend
|
|
||||||
from ...risk_handlers import RiskHandler
|
|
||||||
|
|
||||||
|
|
||||||
class CheckAccountAutomationViewSet(OrgBulkModelViewSet):
|
class CheckAccountAutomationViewSet(OrgBulkModelViewSet):
|
||||||
model = CheckAccountAutomation
|
model = CheckAccountAutomation
|
||||||
filterset_fields = ("name",)
|
filterset_fields = ("name",)
|
||||||
search_fields = filterset_fields
|
search_fields = filterset_fields
|
||||||
|
permission_classes = [RBACPermission, IsValidLicense]
|
||||||
serializer_class = serializers.CheckAccountAutomationSerializer
|
serializer_class = serializers.CheckAccountAutomationSerializer
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,6 +52,7 @@ class CheckAccountExecutionViewSet(AutomationExecutionViewSet):
|
||||||
)
|
)
|
||||||
ordering = ("-date_created",)
|
ordering = ("-date_created",)
|
||||||
tp = AutomationTypes.check_account
|
tp = AutomationTypes.check_account
|
||||||
|
permission_classes = [RBACPermission, IsValidLicense]
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
queryset = super().get_queryset()
|
queryset = super().get_queryset()
|
||||||
|
@ -83,6 +86,7 @@ class AccountRiskViewSet(OrgBulkModelViewSet):
|
||||||
search_fields = ["username", "asset__name"]
|
search_fields = ["username", "asset__name"]
|
||||||
filterset_fields = ("risk", "status", "asset_id")
|
filterset_fields = ("risk", "status", "asset_id")
|
||||||
extra_filter_backends = [NodeFilterBackend]
|
extra_filter_backends = [NodeFilterBackend]
|
||||||
|
permission_classes = [RBACPermission, IsValidLicense]
|
||||||
serializer_classes = {
|
serializer_classes = {
|
||||||
"default": serializers.AccountRiskSerializer,
|
"default": serializers.AccountRiskSerializer,
|
||||||
"assets": serializers.AssetRiskSerializer,
|
"assets": serializers.AssetRiskSerializer,
|
||||||
|
@ -141,7 +145,7 @@ class AccountRiskViewSet(OrgBulkModelViewSet):
|
||||||
class CheckAccountEngineViewSet(JMSModelViewSet):
|
class CheckAccountEngineViewSet(JMSModelViewSet):
|
||||||
search_fields = ("name",)
|
search_fields = ("name",)
|
||||||
serializer_class = serializers.CheckAccountEngineSerializer
|
serializer_class = serializers.CheckAccountEngineSerializer
|
||||||
|
permission_classes = [RBACPermission, IsValidLicense]
|
||||||
perm_model = CheckAccountEngine
|
perm_model = CheckAccountEngine
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsible-content {
|
.collapsible-content {
|
||||||
overflow: hidden;
|
overflow: auto;
|
||||||
max-height: 1000px;
|
max-height: 1000px;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
||||||
|
|
|
@ -247,7 +247,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsible-content {
|
.collapsible-content {
|
||||||
overflow: hidden;
|
overflow: auto;
|
||||||
max-height: 1000px;
|
max-height: 1000px;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
||||||
|
|
|
@ -180,7 +180,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsible-content {
|
.collapsible-content {
|
||||||
overflow: hidden;
|
overflow: auto;
|
||||||
max-height: 1000px;
|
max-height: 1000px;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
||||||
|
|
|
@ -245,7 +245,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsible-content {
|
.collapsible-content {
|
||||||
overflow: hidden;
|
overflow: auto;
|
||||||
max-height: 1000px;
|
max-height: 1000px;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
||||||
|
|
|
@ -246,7 +246,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsible-content {
|
.collapsible-content {
|
||||||
overflow: hidden;
|
overflow: auto;
|
||||||
max-height: 1000px;
|
max-height: 1000px;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
||||||
|
|
|
@ -68,3 +68,9 @@ class ServiceAccountSignaturePermission(permissions.BasePermission):
|
||||||
|
|
||||||
def has_object_permission(self, request, view, obj):
|
def has_object_permission(self, request, view, obj):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
class IsValidLicense(permissions.BasePermission):
|
||||||
|
|
||||||
|
def has_permission(self, request, view):
|
||||||
|
return settings.XPACK_LICENSE_IS_VALID
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"Accept": "同意",
|
"Accept": "同意",
|
||||||
"AccessIP": "IP 白名单",
|
"AccessIP": "IP 白名单",
|
||||||
"AccessKey": "访问密钥",
|
"AccessKey": "访问密钥",
|
||||||
"Account": "账号信息",
|
"Account": "账号",
|
||||||
"AccountActivities": "账号活动",
|
"AccountActivities": "账号活动",
|
||||||
"AccountBackup": "账号备份",
|
"AccountBackup": "账号备份",
|
||||||
"AccountBackupCreate": "创建账号备份",
|
"AccountBackupCreate": "创建账号备份",
|
||||||
|
|
Loading…
Reference in New Issue