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);