From 9b2e1e08d8f125c482f7818a103b0898ce333458 Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Thu, 23 Dec 2021 17:27:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=86redis=5Facl=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=88=B0redis=E5=8D=8F=E8=AE=AE=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/api/system_user.py | 2 -- apps/assets/filters.py | 10 ---------- apps/assets/models/user.py | 3 +-- apps/terminal/models/session.py | 3 +-- 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/apps/assets/api/system_user.py b/apps/assets/api/system_user.py index 15c541eaa..cf61be658 100644 --- a/apps/assets/api/system_user.py +++ b/apps/assets/api/system_user.py @@ -19,7 +19,6 @@ from ..tasks import ( push_system_user_to_assets_manual, test_system_user_connectivity_manual, push_system_user_to_assets ) -from ..filters import ProtocolInFilterBackend logger = get_logger(__file__) __all__ = [ @@ -41,7 +40,6 @@ class SystemUserViewSet(SuggestionMixin, OrgBulkModelViewSet): 'type': ['exact', 'in'], } search_fields = filterset_fields - extra_filter_backends = [ProtocolInFilterBackend] serializer_class = serializers.SystemUserSerializer serializer_classes = { 'default': serializers.SystemUserSerializer, diff --git a/apps/assets/filters.py b/apps/assets/filters.py index 20119aced..b807396e0 100644 --- a/apps/assets/filters.py +++ b/apps/assets/filters.py @@ -149,13 +149,3 @@ class IpInFilterBackend(filters.BaseFilterBackend): ) ) ] - - -class ProtocolInFilterBackend(filters.BaseFilterBackend): - def filter_queryset(self, request, queryset, view): - protocols = request.query_params.get('protocols') - if not protocols: - return queryset - protocol_list = [i.strip() for i in protocols.split(',')] - queryset = queryset.filter(protocol__in=protocol_list) - return queryset diff --git a/apps/assets/models/user.py b/apps/assets/models/user.py index 47f05bf83..0059785f7 100644 --- a/apps/assets/models/user.py +++ b/apps/assets/models/user.py @@ -30,7 +30,6 @@ class ProtocolMixin: vnc = 'vnc', 'VNC' mysql = 'mysql', 'MySQL' redis = 'redis', 'Redis' - redis_acl = 'redis_acl', 'Redis ACL' oracle = 'oracle', 'Oracle' mariadb = 'mariadb', 'MariaDB' postgresql = 'postgresql', 'PostgreSQL' @@ -46,7 +45,7 @@ class ProtocolMixin: Protocol.rdp ] APPLICATION_CATEGORY_DB_PROTOCOLS = [ - Protocol.mysql, Protocol.redis, Protocol.redis_acl, Protocol.oracle, + Protocol.mysql, Protocol.redis, Protocol.oracle, Protocol.mariadb, Protocol.postgresql, Protocol.sqlserver ] APPLICATION_CATEGORY_CLOUD_PROTOCOLS = [ diff --git a/apps/terminal/models/session.py b/apps/terminal/models/session.py index 43f320267..75c64b41f 100644 --- a/apps/terminal/models/session.py +++ b/apps/terminal/models/session.py @@ -30,7 +30,6 @@ class Session(OrgModelMixin): TELNET = 'telnet', 'telnet' MYSQL = 'mysql', 'mysql' REDIS = 'redis', 'redis' - REDIS_ACL = 'redis_acl', 'redis acl' ORACLE = 'oracle', 'oracle' MARIADB = 'mariadb', 'mariadb' SQLSERVER = 'sqlserver', 'sqlserver' @@ -164,7 +163,7 @@ class Session(OrgModelMixin): @property def db_protocols(self): _PROTOCOL = self.PROTOCOL - return [_PROTOCOL.MYSQL, _PROTOCOL.MARIADB, _PROTOCOL.REDIS, _PROTOCOL.REDIS_ACL, + return [_PROTOCOL.MYSQL, _PROTOCOL.MARIADB, _PROTOCOL.REDIS, _PROTOCOL.ORACLE, _PROTOCOL.POSTGRESQL, _PROTOCOL.SQLSERVER] @property