chore: project permission

This commit is contained in:
xiaojunnuo
2026-02-26 00:12:59 +08:00
parent faf08f6513
commit 3a8b5de8f7
14 changed files with 119 additions and 30 deletions
@@ -98,6 +98,20 @@ export const useProjectStore = defineStore("app.project", () => {
return currentProject.value?.permission === "admin";
});
function hasPermission(value: string) {
if (!isEnterprise.value) {
return true;
}
if (value === "read") {
return isRead.value;
} else if (value === "write") {
return isWrite.value;
} else if (value === "admin") {
return isAdmin.value;
}
return false;
}
function $reset() {
myProjects.value = [];
currentProjectId.value = "";
@@ -118,5 +132,6 @@ export const useProjectStore = defineStore("app.project", () => {
reload,
init,
$reset,
hasPermission,
};
});