Skip to content

Commit

Permalink
Merge pull request #40 from WeBankPartners/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
pobu168 authored Nov 4, 2024
2 parents 5ade2ca + 1993c5f commit 68352bf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-slim
FROM python:3.8-slim-buster
LABEL maintainer = "Webank CTB Team"
# Install logrotate
RUN sed -i 's/deb.debian.org/mirrors.tencentyun.com/g' /etc/apt/sources.list
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile_standalone
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-slim
FROM python:3.8-slim-buster
LABEL maintainer = "Webank CTB Team"
# Install logrotate
RUN sed -i 's/deb.debian.org/mirrors.tencentyun.com/g' /etc/apt/sources.list
Expand Down
17 changes: 13 additions & 4 deletions api/terminal/terminal/apps/assets/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging
import os.path
import re
import concurrent.futures

import ipaddress
from talos.common import cache
Expand Down Expand Up @@ -147,10 +148,18 @@ def list(self,
CONF.asset.asset_field_password: 'password',
CONF.asset.asset_field_desc: 'description'
}
for permission in permissions:
expression_assets = self.list_asset_by_expression(permission['expression'], fields)
auth_asset_ids.extend([auth_asset['asset_id'] for auth_asset in permission['assets']])
auth_asset_ids.extend([asset['id'] for asset in expression_assets])
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
futures = [executor.submit(self.list_asset_by_expression, permission['expression'], fields)
for permission in permissions]
for future in concurrent.futures.as_completed(futures):
expression_assets = future.result()
auth_asset_ids.extend([asset['id'] for asset in expression_assets])
for permission in permissions:
auth_asset_ids.extend([auth_asset['asset_id'] for auth_asset in permission['assets']])
# for permission in permissions:
# expression_assets = self.list_asset_by_expression(permission['expression'], fields)
# auth_asset_ids.extend([auth_asset['asset_id'] for auth_asset in permission['assets']])
# auth_asset_ids.extend([asset['id'] for asset in expression_assets])
auth_asset_ids = set(auth_asset_ids)

datas = []
Expand Down

0 comments on commit 68352bf

Please sign in to comment.