Commit 1d039edc authored by chenshouchao's avatar chenshouchao

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

parent 90d3c40d
...@@ -50,6 +50,19 @@ const BaseInfo = observer(() => { ...@@ -50,6 +50,19 @@ const BaseInfo = observer(() => {
const currentUserName = JSON.parse( const currentUserName = JSON.parse(
localStorage.getItem("userInfo") || "{}" localStorage.getItem("userInfo") || "{}"
).name; ).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, { const { run, loading } = useMyRequest(getProject, {
onSuccess: (result: any) => { onSuccess: (result: any) => {
setProjectInfo(result.data); setProjectInfo(result.data);
...@@ -236,7 +249,7 @@ const BaseInfo = observer(() => { ...@@ -236,7 +249,7 @@ const BaseInfo = observer(() => {
<Loading /> <Loading />
</div> </div>
); );
} else if (currentUserName !== projectInfo.owner) { } else if (!hasEditAuth) {
return <InformationDisplay infoList={infoList} />; return <InformationDisplay infoList={infoList} />;
} else { } else {
return ( 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