Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
amitaibu authored Jul 1, 2023
1 parent f109cd0 commit 017eba7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions IHP/AuthSupport/Authorization.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CanView user model where
--
-- This will throw an error and prevent the view from being rendered when the current user is not the author of the post.
accessDeniedWhen :: Bool -> IO ()
accessDeniedWhen condition = if condition then fail "Access denied" else pure ()
accessDeniedWhen condition = when condition (fail "Access denied")

-- | Stops the action execution with an error message when the access condition is False.
--
Expand All @@ -36,5 +36,5 @@ accessDeniedWhen condition = if condition then fail "Access denied" else pure ()
--
-- This will throw an error and prevent the view from being rendered when the current user is not the author of the post.
accessDeniedUnless :: Bool -> IO ()
accessDeniedUnless condition = if condition then pure () else fail "Access denied"
accessDeniedUnless condition = unless condition (fail "Access denied")

0 comments on commit 017eba7

Please sign in to comment.