From abcb15cb46fd1ac96e29ec0bda8535ebb9900458 Mon Sep 17 00:00:00 2001 From: poloohuang Date: Fri, 3 Sep 2021 12:33:33 +0800 Subject: [PATCH 01/23] fix: fixed approval-process select bugs --- .../views/approval-process/common/render-process-item.vue | 6 +++--- .../approval-process/components/custom-perm-process.vue | 6 +++--- .../approval-process/components/join-group-process.vue | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/src/views/approval-process/common/render-process-item.vue b/frontend/src/views/approval-process/common/render-process-item.vue index cc53f6b62..653e4c87c 100644 --- a/frontend/src/views/approval-process/common/render-process-item.vue +++ b/frontend/src/views/approval-process/common/render-process-item.vue @@ -26,7 +26,7 @@ :key="option.id" :id="option.id" :name="option.name"> - {{ option.name }} + {{ option.name }}
@@ -79,8 +79,8 @@ curTitle () { if (this.list.length > 0 && this.value !== -1) { const tempData = this.list.find(item => item.id === this.value) - if (tempData && tempData.nodes) { - return `${this.$t(`m.approvalProcess['审批节点']`)}:${tempData.nodes.join(' -> ')}` + if (tempData && tempData.node_names) { + return `${this.$t(`m.approvalProcess['审批节点']`)}:${tempData.node_names.join(' -> ')}` } return '' } diff --git a/frontend/src/views/approval-process/components/custom-perm-process.vue b/frontend/src/views/approval-process/components/custom-perm-process.vue index b8f0e6ff2..fe09914c7 100644 --- a/frontend/src/views/approval-process/components/custom-perm-process.vue +++ b/frontend/src/views/approval-process/components/custom-perm-process.vue @@ -62,8 +62,8 @@ :id="option.id" :name="option.name"> - {{ option.name }} + :title="`${$t(`m.approvalProcess['审批节点']`)}:${option.node_names.join(' -> ')}`"> + {{ option.name }}{{option}}
{ if (this.list.length > 0 && payload.process_id !== '') { - return `${this.$t(`m.approvalProcess['审批节点']`)}:${this.list.find(item => item.id === payload.process_id).nodes.join(' -> ')}` + return `${this.$t(`m.approvalProcess['审批节点']`)}:${this.list.find(item => item.id === payload.process_id).node_names.join(' -> ')}` } return '' } diff --git a/frontend/src/views/approval-process/components/join-group-process.vue b/frontend/src/views/approval-process/components/join-group-process.vue index c0fe2fc70..0d1261a0c 100644 --- a/frontend/src/views/approval-process/components/join-group-process.vue +++ b/frontend/src/views/approval-process/components/join-group-process.vue @@ -59,7 +59,7 @@ :key="option.id" :id="option.id" :name="option.name"> - {{ option.name }} + {{ option.name }}
@@ -152,7 +152,7 @@ curTitle () { return payload => { if (this.list.length > 0 && payload.process_id !== '') { - return `${this.$t(`m.approvalProcess['审批节点']`)}:${this.list.find(item => item.id === payload.process_id).nodes.join(' -> ')}` + return `${this.$t(`m.approvalProcess['审批节点']`)}:${this.list.find(item => item.id === payload.process_id).node_names.join(' -> ')}` } return '' } From b9630604441d67f7408071b6f14b2dd74ab9f344 Mon Sep 17 00:00:00 2001 From: poloohuang Date: Fri, 3 Sep 2021 14:38:45 +0800 Subject: [PATCH 02/23] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9C=AA?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E4=BB=BB=E4=BD=95=E6=9D=83=E9=99=90=E5=8F=AF?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E4=B8=BA=E6=8E=A8=E8=8D=90=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/perm-template/components/render-content.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/views/perm-template/components/render-content.vue b/frontend/src/views/perm-template/components/render-content.vue index 5a558f9d1..e0e921d83 100644 --- a/frontend/src/views/perm-template/components/render-content.vue +++ b/frontend/src/views/perm-template/components/render-content.vue @@ -574,6 +574,7 @@ window.changeDialog = true this.commonActions = [] this.linearAction = [] + this.curSelectActions = [] this.requestQueue = ['actions', 'commonActions'] this.fetchActions(value) this.fetchCommonActions(value) From 3cdc637b5fcbf78a9bfa26be6cd686c9928e846b Mon Sep 17 00:00:00 2001 From: poloohuang Date: Mon, 6 Sep 2021 18:40:54 +0800 Subject: [PATCH 03/23] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BB=8E?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=B9=B3=E5=8F=B0=E8=B7=B3=E8=BD=AC=E5=88=B0?= =?UTF-8?q?=E6=9D=83=E9=99=90=E4=B8=AD=E5=BF=83=E6=97=A0=E6=B3=95=E9=80=89?= =?UTF-8?q?=E6=8B=A9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/perm-apply/components/resource-instance-table.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/views/perm-apply/components/resource-instance-table.vue b/frontend/src/views/perm-apply/components/resource-instance-table.vue index 53d7ca9d4..8b4592d7d 100644 --- a/frontend/src/views/perm-apply/components/resource-instance-table.vue +++ b/frontend/src/views/perm-apply/components/resource-instance-table.vue @@ -285,6 +285,7 @@ if (!curData) { return [] } + if (curData.condition.length === 0) curData.condition = ['none'] return _.cloneDeep(curData.condition) }, originalCondition () { From 6caccc9e8073ae7fa9548649693f0f51d4dbecd5 Mon Sep 17 00:00:00 2001 From: poloohuang Date: Tue, 7 Sep 2021 18:15:43 +0800 Subject: [PATCH 04/23] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E9=93=BE=E6=8E=A5=E5=B8=A6=E4=B8=8A=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E8=BF=87=E6=BB=A4bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/perm-apply/apply-join-user-group/index.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/perm-apply/apply-join-user-group/index.vue b/frontend/src/views/perm-apply/apply-join-user-group/index.vue index a41796196..8d6d12042 100644 --- a/frontend/src/views/perm-apply/apply-join-user-group/index.vue +++ b/frontend/src/views/perm-apply/apply-join-user-group/index.vue @@ -177,7 +177,9 @@ } }, created () { - this.searchParams = this.$route.params + this.searchParams = this.$route.query + delete this.searchParams.limit + delete this.searchParams.current this.curRole = this.user.role.type this.searchData = [ { @@ -210,6 +212,7 @@ remoteMethod: this.handleGradeAdmin } ] + this.setCurrentQueryCache(this.refreshCurrentQuery()) const isObject = payload => { return Object.prototype.toString.call(payload) === '[object Object]' } From b020f31a4d025709a5037baea7582ece7db6991a Mon Sep 17 00:00:00 2001 From: poloohuang Date: Tue, 7 Sep 2021 19:59:48 +0800 Subject: [PATCH 05/23] fix: delete Useless code --- .../views/approval-process/components/custom-perm-process.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/approval-process/components/custom-perm-process.vue b/frontend/src/views/approval-process/components/custom-perm-process.vue index fe09914c7..e01a42dcd 100644 --- a/frontend/src/views/approval-process/components/custom-perm-process.vue +++ b/frontend/src/views/approval-process/components/custom-perm-process.vue @@ -63,7 +63,7 @@ :name="option.name"> - {{ option.name }}{{option}} + {{ option.name }}
Date: Fri, 10 Sep 2021 17:04:47 +0800 Subject: [PATCH 06/23] fix: fix v3 build app_desc.yaml env_variables --- saas/build/v3/app_desc.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/saas/build/v3/app_desc.yaml b/saas/build/v3/app_desc.yaml index cd1a512bb..bca23a898 100644 --- a/saas/build/v3/app_desc.yaml +++ b/saas/build/v3/app_desc.yaml @@ -24,6 +24,8 @@ modules: env_variables: - key: DISABLE_COLLECTSTATIC value: 1 + - key: PIP_VERSION + value: 20.2.3 processes: web: command: bash bin/start.sh From cf9b36d3be1260c72dd5020f86c8760c4a86ed32 Mon Sep 17 00:00:00 2001 From: zhu327 Date: Mon, 13 Sep 2021 14:22:48 +0800 Subject: [PATCH 07/23] mod esb url settings --- saas/backend/component/esb.py | 2 +- saas/config/prod.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/saas/backend/component/esb.py b/saas/backend/component/esb.py index a4fb516c0..a71770810 100644 --- a/saas/backend/component/esb.py +++ b/saas/backend/component/esb.py @@ -35,7 +35,7 @@ def _call_esb_api(http_func, url_path, data, timeout=30): } data.update(common_params) - url = f"{settings.BK_PAAS_INNER_HOST}{url_path}" + url = f"{settings.BK_COMPONENT_API_URL}{url_path}" kwargs = {"url": url, "data": data, "headers": headers, "timeout": timeout} ok, data = http_func(**kwargs) diff --git a/saas/config/prod.py b/saas/config/prod.py index 12e3a4968..f4ca9ae7a 100644 --- a/saas/config/prod.py +++ b/saas/config/prod.py @@ -48,6 +48,7 @@ def get_app_service_url(app_code: str) -> str: APP_CODE = APP_ID = os.environ.get("BKPAAS_APP_ID", APP_CODE) SECRET_KEY = APP_TOKEN = os.environ.get("BKPAAS_APP_SECRET", SECRET_KEY) BK_PAAS_INNER_HOST = os.environ.get("BK_PAAS2_INNER_URL", BK_PAAS_INNER_HOST) + BK_COMPONENT_API_URL = os.environ.get("BK_COMPONENT_API_URL") # 正式环境数据库可以在这里配置 DATABASES.update( # 需要兼容V3环境变量 @@ -88,6 +89,8 @@ def get_app_service_url(app_code: str) -> str: # V2 Smart 配置 else: + BK_COMPONENT_API_URL = BK_PAAS_INNER_HOST + # 正式环境数据库可以在这里配置 DATABASES.update( { From 6833a9f8c0f4deb5257ce11b251ef9a4b26c3bf3 Mon Sep 17 00:00:00 2001 From: nannan00 <17491932+nannan00@users.noreply.github.com> Date: Mon, 13 Sep 2021 19:38:25 +0800 Subject: [PATCH 08/23] fix(mgmt api): creat group bind role wrong --- saas/backend/api/management/views/group.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/saas/backend/api/management/views/group.py b/saas/backend/api/management/views/group.py index 85f1158a7..cb5f93d78 100644 --- a/saas/backend/api/management/views/group.py +++ b/saas/backend/api/management/views/group.py @@ -85,7 +85,7 @@ def create(self, request, *args, **kwargs): self.group_check_biz.batch_check_role_group_names_unique(role.id, group_names) groups = self.group_biz.batch_create( - request.role.id, parse_obj_as(List[GroupCreateBean], groups_data), request.user.username + role.id, parse_obj_as(List[GroupCreateBean], groups_data), request.user.username ) # 添加审计信息 From 10861c66aa99a1ffad6a761808a84d10d76730ec Mon Sep 17 00:00:00 2001 From: poloohuang Date: Mon, 13 Sep 2021 19:45:29 +0800 Subject: [PATCH 09/23] =?UTF-8?q?fix:=20=E5=B7=B2=E6=9C=89=E5=AE=9E?= =?UTF-8?q?=E4=BE=8B=E6=9D=83=E9=99=90=E4=B8=8D=E5=BA=94=E8=AF=A5=E7=BA=B3?= =?UTF-8?q?=E5=85=A5=E6=96=B0=E5=AE=9E=E4=BE=8B=E7=94=B3=E8=AF=B7=E9=99=90?= =?UTF-8?q?=E5=88=B6=E6=95=B0=E9=87=8C=20#148?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/perm-apply/components/resource-instance-table.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/perm-apply/components/resource-instance-table.vue b/frontend/src/views/perm-apply/components/resource-instance-table.vue index 8b4592d7d..23d8f895e 100644 --- a/frontend/src/views/perm-apply/components/resource-instance-table.vue +++ b/frontend/src/views/perm-apply/components/resource-instance-table.vue @@ -668,7 +668,7 @@ this.tableList.splice( curIndex, 1, - new Policy({ ...item, tag: 'add', isShowRelatedText: true, inOriginalList }, '', true) + new Policy({ ...item, tag: 'add', isShowRelatedText: true, inOriginalList }, '', false) ) } }) @@ -709,6 +709,7 @@ // 是否带有下一层级的无限制 const isHasNoLimit = v.some(({ id }) => id === '*') const isDisabled = v.some(_ => !!_.disabled) + // 可编辑的才会计数 if (!isHasNoLimit && !isDisabled) { ++newResourceCount } From 25fb88a70641dbd058f0e17fee2fa877871394fc Mon Sep 17 00:00:00 2001 From: nannan00 <17491932+nannan00@users.noreply.github.com> Date: Mon, 13 Sep 2021 20:45:11 +0800 Subject: [PATCH 10/23] fix(mgmt api): creat rating manager auth scope wrong --- saas/backend/trans/open_management.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/saas/backend/trans/open_management.py b/saas/backend/trans/open_management.py index d24c1c4ba..3ead201c7 100644 --- a/saas/backend/trans/open_management.py +++ b/saas/backend/trans/open_management.py @@ -8,6 +8,7 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ +from collections import defaultdict from typing import Dict, List from pydantic.tools import parse_obj_as @@ -106,21 +107,22 @@ def to_role_info(self, data: Dict) -> RoleInfoBean: } """ # 将授权的权限范围数据转换为策略格式的auth_scopes - authorization_scopes = [] + system_authorization_scope_dict = defaultdict(list) for auth_scope in data["authorization_scopes"]: system_id = auth_scope["system"] resources = auth_scope["resources"] action_ids = [action["id"] for action in auth_scope["actions"]] # 转换为策略列表(转换时会对action、实例视图等进行校验) policy_list = self.to_policy_list_for_batch_action_and_resources(system_id, action_ids, resources) - authorization_scopes.append( - { - "system_id": system_id, - # 由于RoleInfoBean需要的action_id是以id表示,而非action_id,所以PolicyBean转为字典时需要用其别名 - "actions": [p.dict(by_alias=True) for p in policy_list.policies], - } - ) + # 由于RoleInfoBean需要的action_id是以id表示,而非action_id,所以PolicyBean转为字典时需要用其别名 + policies = [p.dict(by_alias=True) for p in policy_list.policies] + system_authorization_scope_dict[system_id].extend(policies) + # 将按system分组的数据转为authorization_scopes + authorization_scopes = [ + {"system_id": system_id, "actions": policies} + for system_id, policies in system_authorization_scope_dict.items() + ] # 替换掉data里原有的authorization_scopes data["authorization_scopes"] = authorization_scopes From 78a26c46223efda838eb9b0c8abf1d905693cfcf Mon Sep 17 00:00:00 2001 From: nannan00 <17491932+nannan00@users.noreply.github.com> Date: Tue, 14 Sep 2021 11:01:21 +0800 Subject: [PATCH 11/23] fix(audit): mgmt api - delete group member, Object of type 'Subject' is not JSON serializable --- saas/backend/api/management/views/group.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/saas/backend/api/management/views/group.py b/saas/backend/api/management/views/group.py index cb5f93d78..582c89640 100644 --- a/saas/backend/api/management/views/group.py +++ b/saas/backend/api/management/views/group.py @@ -288,7 +288,7 @@ def destroy(self, request, *args, **kwargs): self.biz.remove_members(str(group.id), members) # 写入审计上下文 - audit_context_setter(group=group, members=members) + audit_context_setter(group=group, members=[m.dict() for m in members]) return Response({}) From f1ab575cad2e0a9ef762035078951e5e1a9caf69 Mon Sep 17 00:00:00 2001 From: zhu327 Date: Tue, 14 Sep 2021 11:01:41 +0800 Subject: [PATCH 12/23] fix: fix v3 smart svc_discovery --- saas/build/v3/app_desc.yaml | 4 ++-- saas/config/prod.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/saas/build/v3/app_desc.yaml b/saas/build/v3/app_desc.yaml index bca23a898..55a59171c 100644 --- a/saas/build/v3/app_desc.yaml +++ b/saas/build/v3/app_desc.yaml @@ -40,5 +40,5 @@ modules: replicas: 1 svc_discovery: bk_saas: - - 'bk_iam' - - 'bk_itsm' + - bk_app_code: 'bk_iam' + - bk_app_code: 'bk_itsm' diff --git a/saas/config/prod.py b/saas/config/prod.py index f4ca9ae7a..ebe13061c 100644 --- a/saas/config/prod.py +++ b/saas/config/prod.py @@ -42,7 +42,7 @@ def get_app_service_url(app_code: str) -> str: value = os.environ["BKPAAS_SERVICE_ADDRESSES_BKSAAS"] decoded_value = json.loads(base64.b64decode(value).decode("utf-8")) - return decoded_value[app_code] + return {item["key"]["bk_app_code"]: item["value"]["prod"] for item in decoded_value}[app_code] # 兼容component的APP_ID,APP_TOKEN APP_CODE = APP_ID = os.environ.get("BKPAAS_APP_ID", APP_CODE) From 6eb01955b0b7d97445a71a05b0c45290a660638a Mon Sep 17 00:00:00 2001 From: poloohuang Date: Tue, 14 Sep 2021 11:08:09 +0800 Subject: [PATCH 13/23] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/perm-apply/components/resource-instance-table.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/perm-apply/components/resource-instance-table.vue b/frontend/src/views/perm-apply/components/resource-instance-table.vue index 23d8f895e..52cbc3fd6 100644 --- a/frontend/src/views/perm-apply/components/resource-instance-table.vue +++ b/frontend/src/views/perm-apply/components/resource-instance-table.vue @@ -668,7 +668,7 @@ this.tableList.splice( curIndex, 1, - new Policy({ ...item, tag: 'add', isShowRelatedText: true, inOriginalList }, '', false) + new Policy({ ...item, tag: 'update', isShowRelatedText: true, inOriginalList }, '', false) ) } }) From 87af016e203a239e73d3954b6658e50d4d2cf576 Mon Sep 17 00:00:00 2001 From: poloohuang Date: Tue, 14 Sep 2021 15:22:03 +0800 Subject: [PATCH 14/23] =?UTF-8?q?fix:=20=E6=99=AE=E9=80=9A=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=B2=A1=E6=9C=89=E4=BB=BB=E4=BD=95=E5=88=86=E7=BA=A7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=97=B6=E6=97=A0=E6=B3=95=E6=B3=A8?= =?UTF-8?q?=E9=94=80=E9=97=AE=E9=A2=98=20#149?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/header/index.vue | 4 ++++ .../views/perm-apply/components/resource-instance-table.vue | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/header/index.vue b/frontend/src/components/header/index.vue index 5e9fc481a..d50350461 100644 --- a/frontend/src/components/header/index.vue +++ b/frontend/src/components/header/index.vue @@ -123,6 +123,10 @@ {{ $t(`m.nav['普通成员']`) }}
+
+ +