Skip to content

Commit

Permalink
Fix useHasPermission minimumRole cascade check (#3949) (#3950)
Browse files Browse the repository at this point in the history
(cherry picked from commit 2f90840)

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
  • Loading branch information
mattermost-build and mgdelacroix authored Oct 6, 2022
1 parent 7f6fb6f commit 524308d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions webapp/src/hooks/permissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 524308d

Please sign in to comment.