From 0b4a7185c639e07b315919644ca6bda0d265197d Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Tue, 17 Dec 2013 15:55:28 +0200 Subject: [PATCH] Add some docs --- yesod-auth/Yesod/Auth.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/yesod-auth/Yesod/Auth.hs b/yesod-auth/Yesod/Auth.hs index f09b2b93..b39980b7 100644 --- a/yesod-auth/Yesod/Auth.hs +++ b/yesod-auth/Yesod/Auth.hs @@ -339,6 +339,11 @@ handlePluginR plugin pieces = do [] -> notFound ap:_ -> apDispatch ap method pieces +-- | Similar to 'maybeAuthId', but additionally look up the value associated +-- with the user\'s database identifier to get the value in the database. This +-- assumes that you are using a Persistent database. +-- +-- Since 1.1.0 maybeAuth :: ( YesodAuth master , PersistMonadBackend (b (HandlerT master IO)) ~ PersistEntityBackend val , b ~ YesodPersistBackend master @@ -388,6 +393,10 @@ type AuthEntity master = KeyEntity (AuthId master) requireAuthId :: YesodAuthPersist master => HandlerT master IO (AuthId master) requireAuthId = maybeAuthId >>= maybe redirectLogin return +-- | Similar to 'maybeAuth', but redirects to a login page if user is not +-- authenticated. +-- +-- Since 1.1.0 requireAuth :: YesodAuthPersist master => HandlerT master IO (Entity (AuthEntity master)) requireAuth = maybeAuth >>= maybe redirectLogin return