diff --git a/src/components/events/partials/ModalTabsAndPages/NewAccessPage.tsx b/src/components/events/partials/ModalTabsAndPages/NewAccessPage.tsx index 1542cd2a2b..b5f71967b8 100644 --- a/src/components/events/partials/ModalTabsAndPages/NewAccessPage.tsx +++ b/src/components/events/partials/ModalTabsAndPages/NewAccessPage.tsx @@ -61,7 +61,15 @@ const NewAccessPage = ({ // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type. const handleTemplateChange = async (value) => { // fetch information about chosen template from backend - const template = await fetchAclTemplateById(value); + let template = await fetchAclTemplateById(value); + + // always add current user to acl since template could lock the user out + template = template.concat({ + role: user.userRole, + read: true, + write: true, + actions: [], + }); formik.setFieldValue("aclTemplate", value); formik.setFieldValue("acls", template); diff --git a/src/components/shared/modals/ResourceDetailsAccessPolicyTab.tsx b/src/components/shared/modals/ResourceDetailsAccessPolicyTab.tsx index 181949900b..f36a780bd7 100644 --- a/src/components/shared/modals/ResourceDetailsAccessPolicyTab.tsx +++ b/src/components/shared/modals/ResourceDetailsAccessPolicyTab.tsx @@ -251,7 +251,15 @@ const ResourceDetailsAccessPolicyTab : React.FC <{ // @ts-expect-error TS(7006): Parameter 'templateId' implicitly has an 'any' typ... Remove this comment to see the full error message const handleTemplateChange = async (templateId, setFormikFieldValue) => { // fetch information about chosen template from backend - const template = await fetchAclTemplateById(templateId); + let template = await fetchAclTemplateById(templateId); + + // always add current user to acl since template could lock the user out + template = template.concat({ + role: user.userRole, + read: true, + write: true, + actions: [], + }); setFormikFieldValue("policies", template); setFormikFieldValue("template", templateId);