From b3da6594e11d453d9dde4a80b443f9c23fe226ab Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Wed, 2 Oct 2024 17:24:49 +0100 Subject: [PATCH] feat: Manage tags permission (#4615) --- frontend/web/components/tags/AddEditTags.tsx | 18 ++++++++++++------ frontend/web/components/tags/CreateEditTag.tsx | 13 +++++++++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/frontend/web/components/tags/AddEditTags.tsx b/frontend/web/components/tags/AddEditTags.tsx index a0169eb9404a..0363268e061c 100644 --- a/frontend/web/components/tags/AddEditTags.tsx +++ b/frontend/web/components/tags/AddEditTags.tsx @@ -40,10 +40,14 @@ const AddEditTags: FC = ({ const [tab, setTab] = useState<'SELECT' | 'CREATE' | 'EDIT'>('SELECT') const [deleteTag] = useDeleteTagMutation() const [createTag] = useCreateTagMutation() - const { permission: projectAdminPermission } = useHasPermission({ + const permissionType = Utils.getFlagsmithHasFeature('manage_tags_permission') + ? 'MANAGE_TAGS' + : 'ADMIN' + + const { permission: createEditTagPermission } = useHasPermission({ id: projectId, level: 'project', - permission: 'ADMIN', + permission: permissionType, }) useEffect(() => { @@ -166,12 +170,14 @@ const AddEditTags: FC = ({ !readOnly && (
{Utils.renderWithPermission( - projectAdminPermission, - Constants.projectPermissions('Admin'), + createEditTagPermission, + Constants.projectPermissions( + permissionType === 'ADMIN' ? 'Admin' : 'Manage Tags', + ),
- + {({ permission }) => Utils.renderWithPermission( permission, - Constants.projectPermissions('Admin'), + Constants.projectPermissions( + permissionType === 'ADMIN' ? 'Admin' : 'Manage Tags', + ),