mirror of https://github.com/jumpserver/jumpserver
Merge pull request #10723 from jumpserver/pr@dev@perf_json_attr_m2m_filter
perf: 优化 json m2m filterpull/10724/head
commit
abd4e87bc2
|
@ -502,7 +502,7 @@ class JSONManyToManyDescriptor:
|
||||||
value = [value.id]
|
value = [value.id]
|
||||||
value = set(map(str, value))
|
value = set(map(str, value))
|
||||||
rule_value = set(map(str, rule_value))
|
rule_value = set(map(str, rule_value))
|
||||||
res &= value.issubset(rule_value)
|
res &= value & rule_value
|
||||||
else:
|
else:
|
||||||
logging.error("unknown match: {}".format(rule['match']))
|
logging.error("unknown match: {}".format(rule['match']))
|
||||||
res &= False
|
res &= False
|
||||||
|
|
|
@ -104,13 +104,15 @@ class NativeClient(TextChoices):
|
||||||
xpack_protocols = cls.xpack_protocols()
|
xpack_protocols = cls.xpack_protocols()
|
||||||
|
|
||||||
for protocol, _clients in clients_map.items():
|
for protocol, _clients in clients_map.items():
|
||||||
|
if not settings.XPACK_ENABLED and protocol in xpack_protocols:
|
||||||
|
continue
|
||||||
|
|
||||||
if isinstance(_clients, dict):
|
if isinstance(_clients, dict):
|
||||||
if os == 'all':
|
if os == 'all':
|
||||||
_clients = list(itertools.chain(*_clients.values()))
|
_clients = list(itertools.chain(*_clients.values()))
|
||||||
else:
|
else:
|
||||||
_clients = _clients.get(os, _clients['default'])
|
_clients = _clients.get(os, _clients['default'])
|
||||||
if protocol in xpack_protocols:
|
|
||||||
continue
|
|
||||||
for client in _clients:
|
for client in _clients:
|
||||||
if not settings.XPACK_ENABLED and client in cls.xpack_methods():
|
if not settings.XPACK_ENABLED and client in cls.xpack_methods():
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue