From 524308d5238d177ad5e71c29cdb37b66b7e776fe Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Thu, 6 Oct 2022 18:58:39 +0300 Subject: [PATCH] Fix useHasPermission minimumRole cascade check (#3949) (#3950) (cherry picked from commit 2f90840ae867c1b67aac58de386f3ce8d002167a) Co-authored-by: Miguel de la Cruz --- webapp/src/hooks/permissions.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/src/hooks/permissions.tsx b/webapp/src/hooks/permissions.tsx index e26bec2a7cd..a050d45e5a5 100644 --- a/webapp/src/hooks/permissions.tsx +++ b/webapp/src/hooks/permissions.tsx @@ -40,10 +40,10 @@ export const useHasPermissions = (teamId: string, boardId: string, permissions: if (editorPermissions.includes(permission) && (member.schemeAdmin || member.schemeEditor || board.minimumRole === MemberRole.Editor)) { return true } - if (commenterPermissions.includes(permission) && (member.schemeAdmin || member.schemeEditor || member.schemeCommenter || board.minimumRole === MemberRole.Commenter)) { + if (commenterPermissions.includes(permission) && (member.schemeAdmin || member.schemeEditor || member.schemeCommenter || board.minimumRole === MemberRole.Commenter || board.minimumRole === MemberRole.Editor)) { return true } - if (viewerPermissions.includes(permission) && (member.schemeAdmin || member.schemeEditor || member.schemeCommenter || member.schemeViewer || board.minimumRole === MemberRole.Viewer)) { + if (viewerPermissions.includes(permission) && (member.schemeAdmin || member.schemeEditor || member.schemeCommenter || member.schemeViewer || board.minimumRole === MemberRole.Viewer || board.minimumRole === MemberRole.Commenter || board.minimumRole === MemberRole.Editor)) { return true } }