From d1a65922d7e152d6edcf6c53b70079f16b54a0d3 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Thu, 2 Apr 2026 16:28:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E6=8A=A5=E6=97=A0=E6=B3=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=80=9A=E7=9F=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../certd/access/access-selector/index.vue | 25 ++++++++++++++++--- .../certd/addon/addon-selector/index.vue | 22 ++++++++++++---- .../notification-selector/index.vue | 19 +++++++++++--- 3 files changed, 53 insertions(+), 13 deletions(-) diff --git a/packages/ui/certd-client/src/views/certd/access/access-selector/index.vue b/packages/ui/certd-client/src/views/certd/access/access-selector/index.vue index a60bbaa0b..e50653f19 100644 --- a/packages/ui/certd-client/src/views/certd/access/access-selector/index.vue +++ b/packages/ui/certd-client/src/views/certd/access/access-selector/index.vue @@ -21,7 +21,8 @@ import { defineComponent, reactive, ref, watch, inject } from "vue"; import CertAccessModal from "./access/index.vue"; import { createAccessApi } from "../api"; import { message } from "ant-design-vue"; - +import { useUserStore } from "/@/store/user"; +import { useProjectStore } from "/@/store/project"; export default defineComponent({ name: "AccessSelector", components: { CertAccessModal }, @@ -71,11 +72,27 @@ export default defineComponent({ emitValue(null); } + const userStore = useUserStore(); + const projectStore = useProjectStore(); + async function emitValue(value) { - if (pipeline && pipeline?.value && target?.value && pipeline.value.userId !== target.value.userId) { - message.error("对不起,您不能修改他人流水线的授权"); - return; + const userId = userStore.userInfo.id; + const isEnterprice = projectStore.isEnterprise; + if (pipeline.value) { + if (isEnterprice) { + const projectId = projectStore.currentProjectId; + if (pipeline.value.projectId !== projectId) { + message.error(`对不起,您不能修改其他项目流水线的授权`); + return; + } + } else { + if (pipeline?.value && pipeline.value.userId !== userId) { + message.error(`对不起,您不能修改他人流水线的授权`); + return; + } + } } + if (value == null) { selectedId.value = ""; target.value = null; diff --git a/packages/ui/certd-client/src/views/certd/addon/addon-selector/index.vue b/packages/ui/certd-client/src/views/certd/addon/addon-selector/index.vue index e7e75e6eb..5bbc157d7 100644 --- a/packages/ui/certd-client/src/views/certd/addon/addon-selector/index.vue +++ b/packages/ui/certd-client/src/views/certd/addon/addon-selector/index.vue @@ -48,6 +48,7 @@ import createCrudOptions from "../crud"; import { addonProvide } from "../common"; import { useUserStore } from "/@/store/user"; import { useI18n } from "/src/locales"; +import { useProjectStore } from "/@/store/project"; const { t } = useI18n(); @@ -127,13 +128,24 @@ function clear() { } const userStore = useUserStore(); - +const projectStore = useProjectStore(); async function emitValue(value: any) { // target.value = optionsDictRef.dataMap[value]; - const userId = userStore.userInfo.id; - if (pipeline?.value && pipeline.value.userId !== userId) { - message.error(`对不起,您不能修改他人流水线的${props.addonType}设置`); - return; + if (pipeline.value) { + const userId = userStore.userInfo.id; + const isEnterprice = projectStore.isEnterprise; + if (isEnterprice) { + const projectId = projectStore.currentProjectId; + if (pipeline.value.projectId !== projectId) { + message.error(`对不起,您不能修改其他项目流水线的${props.addonType}设置`); + return; + } + } else { + if (pipeline?.value && pipeline.value.userId !== userId) { + message.error(`对不起,您不能修改他人流水线的${props.addonType}设置`); + return; + } + } } emit("change", value); emit("update:modelValue", value); diff --git a/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue b/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue index 14c53dde9..fcc9d841c 100644 --- a/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue +++ b/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue @@ -42,6 +42,7 @@ import createCrudOptions from "../crud"; import { notificationProvide } from "/@/views/certd/notification/common"; import { useUserStore } from "/@/store/user"; import { useI18n } from "/src/locales"; +import { useProjectStore } from "/@/store/project"; const { t } = useI18n(); @@ -127,13 +128,23 @@ function clear() { } const userStore = useUserStore(); - +const projectStore = useProjectStore(); async function emitValue(value: any) { // target.value = optionsDictRef.dataMap[value]; const userId = userStore.userInfo.id; - if (pipeline?.value && pipeline.value.userId !== userId) { - message.error("对不起,您不能修改他人流水线的通知"); - return; + const isEnterprice = projectStore.isEnterprise; + + if (isEnterprice) { + const projectId = projectStore.currentProjectId; + if (pipeline.value.projectId !== projectId) { + message.error("对不起,您不能修改其他项目流水线的通知"); + return; + } + } else { + if (pipeline.value.userId !== userId) { + message.error("对不起,您不能修改他人流水线的通知"); + return; + } } emit("change", value); emit("update:modelValue", value);