Commit 1d039edc authored by chenshouchao's avatar chenshouchao

feat: 项目基础信息编辑权限逻辑修改

parent 90d3c40d
......@@ -50,6 +50,19 @@ const BaseInfo = observer(() => {
const currentUserName = JSON.parse(
localStorage.getItem("userInfo") || "{}"
).name;
const hasEditAuth = useMemo(() => {
if (!currentUserName) {
return false;
} else if (!projectInfo.members) {
return false;
} else {
return projectInfo.members.some((item: any) => {
return (
item.username === currentUserName && item.projectRole === "OWNER"
);
});
}
}, [currentUserName, projectInfo]);
const { run, loading } = useMyRequest(getProject, {
onSuccess: (result: any) => {
setProjectInfo(result.data);
......@@ -236,7 +249,7 @@ const BaseInfo = observer(() => {
<Loading />
</div>
);
} else if (currentUserName !== projectInfo.owner) {
} else if (!hasEditAuth) {
return <InformationDisplay infoList={infoList} />;
} else {
return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment