From ed4b0ca2286e19ece58153c9c1710ba7f11d1df0 Mon Sep 17 00:00:00 2001 From: Martastain Date: Thu, 17 Oct 2024 15:23:52 +0200 Subject: [PATCH] feat: limit project management pages p.o.c. --- .../ProjectManagerPage/ProjectAnatomy.jsx | 16 ++++++++++-- .../ProjectManagerPage/ProjectManagerPage.jsx | 26 +++++++++++-------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/pages/ProjectManagerPage/ProjectAnatomy.jsx b/src/pages/ProjectManagerPage/ProjectAnatomy.jsx index 60cd02400..ec902a90d 100644 --- a/src/pages/ProjectManagerPage/ProjectAnatomy.jsx +++ b/src/pages/ProjectManagerPage/ProjectAnatomy.jsx @@ -2,6 +2,7 @@ import { toast } from 'react-toastify' import { useState } from 'react' import { ScrollPanel, SaveButton, Spacer, Button } from '@ynput/ayon-react-components' import { useUpdateProjectAnatomyMutation } from '@queries/project/updateProject' +import { useGetCurrentUserProjectPermissionsQuery } from '@queries/permissions/getPermissions' import ProjectManagerPageLayout from './ProjectManagerPageLayout' import AnatomyEditor from '@containers/AnatomyEditor' @@ -15,6 +16,15 @@ const ProjectAnatomy = ({ projectName, projectList }) => { const [updateProjectAnatomy, { isLoading: isUpdating }] = useUpdateProjectAnatomyMutation() const { requestPaste } = usePaste() + + const { data: permissions } = useGetCurrentUserProjectPermissionsQuery({ + projectName: projectName, + }) + + const accessLevel = permissions?.project?.enabled ? permissions.project.anatomy : 2 + //const accessLevel = 2 + + const saveAnatomy = () => { updateProjectAnatomy({ projectName, anatomy: formData }) .unwrap() @@ -62,23 +72,25 @@ const ProjectAnatomy = ({ projectName, projectList }) => { }} />