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 }) => {
}}
/>
+ {accessLevel === 1 && "Read-only"}
1}
saving={isUpdating}
/>
>
}
>
+ {accessLevel ? (
+ />) : "You don't have access to this project's anatomy. We should redirect you somewhere else."}
)
diff --git a/src/pages/ProjectManagerPage/ProjectManagerPage.jsx b/src/pages/ProjectManagerPage/ProjectManagerPage.jsx
index 388a2cc5a..4dfa496a8 100644
--- a/src/pages/ProjectManagerPage/ProjectManagerPage.jsx
+++ b/src/pages/ProjectManagerPage/ProjectManagerPage.jsx
@@ -49,7 +49,9 @@ const ProjectManagerPage = () => {
withDefault(StringParam, projectName),
)
- const { data: permissions} = useGetCurrentUserProjectPermissionsQuery({ projectName: selectedProject })
+ const { data: permissions } = useGetCurrentUserProjectPermissionsQuery({
+ projectName: selectedProject,
+ })
// UPDATE DATA
const [updateProject] = useUpdateProjectMutation()
@@ -85,20 +87,23 @@ const ProjectManagerPage = () => {
}
const links = []
- const projectPermissions = permissions?.project_settings
+ if (permissions?.project) {
+ // How to read this code:
+ // If project management restrictions are NOT enabled
+ // OR if project management restrctions ARE enabled
+ // and access to anatomy is allowed
- if (projectPermissions){
- if (!projectPermissions.enabled || projectPermissions.anatomy_update) {
+ if (!permissions.project.enabled || permissions.project.anatomy) {
links.push({
- name: 'Anatomy',
- path: '/manageProjects/anatomy',
- module: 'anatomy',
- accessLevels: [],
- shortcut: 'A+A',
+ name: 'Anatomy',
+ path: '/manageProjects/anatomy',
+ module: 'anatomy',
+ accessLevels: [],
+ shortcut: 'A+A',
})
}
- if (!projectPermissions.enabled || projectPermissions.addon_settings_update) {
+ if (!permissions.project.enabled || permissions.project.settings) {
links.push({
name: 'Project settings',
path: '/manageProjects/projectSettings',
@@ -109,7 +114,6 @@ const ProjectManagerPage = () => {
}
}
-
links.push(
{
name: 'Site settings',