From 004980009ba4e56e43979308a56bd549b9570e1b Mon Sep 17 00:00:00 2001 From: matheus-relief Date: Thu, 26 Oct 2023 02:14:57 -0300 Subject: [PATCH 1/2] refactor: remove canUpdate along with canSee for fields --- src/schema/mutation/editResource.mutation.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/schema/mutation/editResource.mutation.ts b/src/schema/mutation/editResource.mutation.ts index 031f55c11..a4c835864 100644 --- a/src/schema/mutation/editResource.mutation.ts +++ b/src/schema/mutation/editResource.mutation.ts @@ -699,6 +699,17 @@ export default { obj.remove.role, permission ); + + // If we remove the canSee of a field, we should remove the canUpdate as well + if (permission === 'canSee') { + removeFieldPermission( + update, + allResourceFields, + obj.remove.field, + obj.remove.role, + 'canUpdate' + ); + } } } } From 29d8363388d7e23c1fc662a2b01974777cdec27c Mon Sep 17 00:00:00 2001 From: matheus-relief Date: Thu, 26 Oct 2023 02:14:57 -0300 Subject: [PATCH 2/2] refactor: remove canUpdate along with canSee for fields --- src/schema/mutation/editResource.mutation.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/schema/mutation/editResource.mutation.ts b/src/schema/mutation/editResource.mutation.ts index ca129f482..7de0e8e79 100644 --- a/src/schema/mutation/editResource.mutation.ts +++ b/src/schema/mutation/editResource.mutation.ts @@ -698,6 +698,17 @@ export default { obj.remove.role, permission ); + + // If we remove the canSee of a field, we should remove the canUpdate as well + if (permission === 'canSee') { + removeFieldPermission( + update, + allResourceFields, + obj.remove.field, + obj.remove.role, + 'canUpdate' + ); + } } } }