From 017eba700cff38d3cbe44724ea224d6c036a4893 Mon Sep 17 00:00:00 2001 From: Amitai Burstein Date: Sat, 1 Jul 2023 17:46:17 +0300 Subject: [PATCH] Apply suggestions from code review --- IHP/AuthSupport/Authorization.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IHP/AuthSupport/Authorization.hs b/IHP/AuthSupport/Authorization.hs index 9409fa602..2baa5fb91 100644 --- a/IHP/AuthSupport/Authorization.hs +++ b/IHP/AuthSupport/Authorization.hs @@ -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. -- @@ -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")