From 2d375a1bfe8a609e11d3a4be031a5467dbc36f15 Mon Sep 17 00:00:00 2001 From: durant <826035498@qq.com> Date: Tue, 5 Dec 2023 21:48:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(backend):=20=E5=AE=A1=E8=AE=A1=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=20resource=20=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20#2342?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto_create_release.yml | 30 +++++++++---------- dbm-ui/backend/iam_app/handlers/drf_perm.py | 6 +++- helm-charts/bk-dbm/Chart.yaml | 4 +-- .../bk-dbm/charts/backup-server/Chart.yaml | 2 +- .../bk-dbm/charts/db-resource/Chart.yaml | 2 +- helm-charts/bk-dbm/charts/dbconfig/Chart.yaml | 2 +- helm-charts/bk-dbm/charts/dbm/Chart.yaml | 2 +- 7 files changed, 26 insertions(+), 22 deletions(-) diff --git a/.github/workflows/auto_create_release.yml b/.github/workflows/auto_create_release.yml index 4313e61b21..33b2e4fcf0 100644 --- a/.github/workflows/auto_create_release.yml +++ b/.github/workflows/auto_create_release.yml @@ -30,7 +30,7 @@ jobs: github.rest.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, - ref: 'refs/tags/v${{ steps.yaml-data.outputs.data }}', + ref: 'refs/tags/temp-${{ steps.yaml-data.outputs.data }}', sha: context.sha }) @@ -45,19 +45,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - id: delete-temporary-tag - name: Delete temporary tag - uses: actions/github-script@v6 - with: - # 参考 https://octokit.github.io/rest.js/v18#git-delete-ref - # 参考 https://github.com/actions/github-script - script: | - github.rest.git.deleteRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'tags/v${{ steps.yaml-data.outputs.data }}' - }) - - id: create-tag name: Create tag uses: actions/github-script@v6 @@ -81,4 +68,17 @@ jobs: release_name: ${{ steps.yaml-data.outputs.data }} body: ${{ steps.build-release-log.outputs.changelog }} draft: false - prerelease: true \ No newline at end of file + prerelease: true + + - id: delete-temporary-tag + name: Delete temporary tag + uses: actions/github-script@v6 + with: + # 参考 https://octokit.github.io/rest.js/v18#git-delete-ref + # 参考 https://github.com/actions/github-script + script: | + github.rest.git.deleteRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'tags/temp-${{ steps.yaml-data.outputs.data }}' + }) \ No newline at end of file diff --git a/dbm-ui/backend/iam_app/handlers/drf_perm.py b/dbm-ui/backend/iam_app/handlers/drf_perm.py index fe0719cea3..e278393457 100644 --- a/dbm-ui/backend/iam_app/handlers/drf_perm.py +++ b/dbm-ui/backend/iam_app/handlers/drf_perm.py @@ -58,6 +58,8 @@ class IAMPermission(permissions.BasePermission): 作为drf-iam鉴权的基类 """ + resource_type = None + def __init__(self, actions: List[ActionMeta], resources: List[Resource] = None) -> None: self.actions = actions self.resources = resources or [] @@ -74,7 +76,7 @@ def has_permission(self, request, view): for resource in self.resources: bk_audit_client.add_event( action=action, - resource_type=resource, + resource_type=self.resource_type() if self.resource_type else resource, audit_context=context, instance=CommonInstance(resource.attribute), ) @@ -105,6 +107,8 @@ class BusinessIAMPermission(IAMPermission): 业务相关动作的鉴权 """ + resource_type = BusinessResourceMeta + def __init__(self, actions: List[ActionMeta], resources: List[Resource] = None, bk_biz_id: int = None) -> None: self.bk_biz_id = bk_biz_id super().__init__(actions, resources) diff --git a/helm-charts/bk-dbm/Chart.yaml b/helm-charts/bk-dbm/Chart.yaml index ca9025ee2c..2209aca3e9 100644 --- a/helm-charts/bk-dbm/Chart.yaml +++ b/helm-charts/bk-dbm/Chart.yaml @@ -79,5 +79,5 @@ dependencies: description: A Helm chart for bkdbm name: bk-dbm type: application -version: 1.3.0-alpha.13 -appVersion: 1.3.0-alpha.13 +version: 1.3.0-alpha.14 +appVersion: 1.3.0-alpha.14 diff --git a/helm-charts/bk-dbm/charts/backup-server/Chart.yaml b/helm-charts/bk-dbm/charts/backup-server/Chart.yaml index 115afd84ba..991c995b24 100644 --- a/helm-charts/bk-dbm/charts/backup-server/Chart.yaml +++ b/helm-charts/bk-dbm/charts/backup-server/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -appVersion: 0.0.1-alpha.31 +appVersion: 0.0.1-alpha.35 description: A Helm chart for backup-server name: backup-server type: application diff --git a/helm-charts/bk-dbm/charts/db-resource/Chart.yaml b/helm-charts/bk-dbm/charts/db-resource/Chart.yaml index e8bb9e08dd..6130ebd87e 100644 --- a/helm-charts/bk-dbm/charts/db-resource/Chart.yaml +++ b/helm-charts/bk-dbm/charts/db-resource/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -appVersion: 0.0.1-alpha.56 +appVersion: 0.0.1-alpha.64 description: A Helm chart for Kubernetes name: db-resource type: application diff --git a/helm-charts/bk-dbm/charts/dbconfig/Chart.yaml b/helm-charts/bk-dbm/charts/dbconfig/Chart.yaml index 1453be1420..2d15144247 100644 --- a/helm-charts/bk-dbm/charts/dbconfig/Chart.yaml +++ b/helm-charts/bk-dbm/charts/dbconfig/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -appVersion: 0.0.1-alpha.62 +appVersion: 0.0.1-alpha.63 description: A Helm chart for dbconfig name: dbconfig type: application diff --git a/helm-charts/bk-dbm/charts/dbm/Chart.yaml b/helm-charts/bk-dbm/charts/dbm/Chart.yaml index c2f3339963..cf5770202d 100644 --- a/helm-charts/bk-dbm/charts/dbm/Chart.yaml +++ b/helm-charts/bk-dbm/charts/dbm/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -appVersion: 1.3.0-alpha.39 +appVersion: 1.3.0-alpha.61 description: A Helm chart for dbm name: dbm type: application