Merge branch 'v2-dev' of https://github.com/certd/certd into v2-dev

This commit is contained in:
xiaojunnuo
2026-04-03 00:14:14 +08:00
4 changed files with 54 additions and 14 deletions

View File

@@ -21,7 +21,8 @@ import { defineComponent, reactive, ref, watch, inject } from "vue";
import CertAccessModal from "./access/index.vue"; import CertAccessModal from "./access/index.vue";
import { createAccessApi } from "../api"; import { createAccessApi } from "../api";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import { useUserStore } from "/@/store/user";
import { useProjectStore } from "/@/store/project";
export default defineComponent({ export default defineComponent({
name: "AccessSelector", name: "AccessSelector",
components: { CertAccessModal }, components: { CertAccessModal },
@@ -71,11 +72,27 @@ export default defineComponent({
emitValue(null); emitValue(null);
} }
const userStore = useUserStore();
const projectStore = useProjectStore();
async function emitValue(value) { async function emitValue(value) {
if (pipeline && pipeline?.value && target?.value && pipeline.value.userId !== target.value.userId) { const userId = userStore.userInfo.id;
message.error("对不起,您不能修改他人流水线的授权"); const isEnterprice = projectStore.isEnterprise;
return; 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) { if (value == null) {
selectedId.value = ""; selectedId.value = "";
target.value = null; target.value = null;

View File

@@ -48,6 +48,7 @@ import createCrudOptions from "../crud";
import { addonProvide } from "../common"; import { addonProvide } from "../common";
import { useUserStore } from "/@/store/user"; import { useUserStore } from "/@/store/user";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { useProjectStore } from "/@/store/project";
const { t } = useI18n(); const { t } = useI18n();
@@ -127,13 +128,24 @@ function clear() {
} }
const userStore = useUserStore(); const userStore = useUserStore();
const projectStore = useProjectStore();
async function emitValue(value: any) { async function emitValue(value: any) {
// target.value = optionsDictRef.dataMap[value]; // target.value = optionsDictRef.dataMap[value];
const userId = userStore.userInfo.id; if (pipeline.value) {
if (pipeline?.value && pipeline.value.userId !== userId) { const userId = userStore.userInfo.id;
message.error(`对不起,您不能修改他人流水线的${props.addonType}设置`); const isEnterprice = projectStore.isEnterprise;
return; 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("change", value);
emit("update:modelValue", value); emit("update:modelValue", value);

View File

@@ -42,6 +42,7 @@ import createCrudOptions from "../crud";
import { notificationProvide } from "/@/views/certd/notification/common"; import { notificationProvide } from "/@/views/certd/notification/common";
import { useUserStore } from "/@/store/user"; import { useUserStore } from "/@/store/user";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { useProjectStore } from "/@/store/project";
const { t } = useI18n(); const { t } = useI18n();
@@ -127,13 +128,23 @@ function clear() {
} }
const userStore = useUserStore(); const userStore = useUserStore();
const projectStore = useProjectStore();
async function emitValue(value: any) { async function emitValue(value: any) {
// target.value = optionsDictRef.dataMap[value]; // target.value = optionsDictRef.dataMap[value];
const userId = userStore.userInfo.id; const userId = userStore.userInfo.id;
if (pipeline?.value && pipeline.value.userId !== userId) { const isEnterprice = projectStore.isEnterprise;
message.error("对不起,您不能修改他人流水线的通知");
return; 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("change", value);
emit("update:modelValue", value); emit("update:modelValue", value);

View File

@@ -156,7 +156,7 @@ export abstract class CertApplyBasePlugin extends CertApplyBaseConvertPlugin {
if(maxDays < 2){ if(maxDays < 2){
maxDays = 2; maxDays = 2;
} }
this.logger.warn(`为避免每次运行都更新证书,更新天数自动减半,调整为${maxDays}`); this.logger.warn(`为避免每次运行都更新证书,更新天数自动减半(即证书最大时长${totalDays}天减半),调整为${maxDays}`);
} }
return { return {