feat: 将redis_acl协议合并到redis协议中

pull/7447/head
jiangweidong 2021-12-23 17:27:57 +08:00 committed by 老广
parent aaaa87dd60
commit 9b2e1e08d8
4 changed files with 2 additions and 16 deletions

View File

@ -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,

View File

@ -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

View File

@ -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 = [

View File

@ -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