Fixed type signature in some functions in Yesod typeclass
This commit is contained in:
parent
ac8d0fb800
commit
729751f742
@ -246,14 +246,14 @@ toWaiApp' y segments env = do
|
||||
eurl = parsePathSegments site pathSegments
|
||||
render u = fromMaybe
|
||||
(fullRender (approot y) (formatPathSegments site) u)
|
||||
(urlRenderOverride y u)
|
||||
(urlRenderOverride u)
|
||||
rr <- parseWaiRequest env session'
|
||||
onRequest y rr
|
||||
let h =
|
||||
let h = do
|
||||
onRequest
|
||||
case eurl of
|
||||
Left _ -> errorHandler NotFound
|
||||
Right url -> do
|
||||
-- FIXME auth <- isAuthorized y url
|
||||
isAuthorized url >>= maybe (return ()) permissionDenied
|
||||
case handleSite site render url method of
|
||||
Nothing -> errorHandler $ BadMethod method
|
||||
Just h' -> h'
|
||||
|
||||
@ -364,8 +364,8 @@ badMethod = do
|
||||
failure $ BadMethod $ toString $ W.methodToBS $ W.requestMethod w
|
||||
|
||||
-- | Return a 403 permission denied page.
|
||||
permissionDenied :: Failure ErrorResponse m => m a
|
||||
permissionDenied = failure $ PermissionDenied "Permission denied"
|
||||
permissionDenied :: Failure ErrorResponse m => String -> m a
|
||||
permissionDenied = failure . PermissionDenied
|
||||
|
||||
-- | Return a 400 invalid arguments page.
|
||||
invalidArgs :: Failure ErrorResponse m => [(ParamName, String)] -> m a
|
||||
|
||||
@ -85,22 +85,22 @@ class Yesod a where
|
||||
|]
|
||||
|
||||
-- | Gets called at the beginning of each request. Useful for logging.
|
||||
onRequest :: a -> Request -> IO ()
|
||||
onRequest _ _ = return ()
|
||||
onRequest :: GHandler sub a ()
|
||||
onRequest = return ()
|
||||
|
||||
-- | Override the rendering function for a particular URL. One use case for
|
||||
-- this is to offload static hosting to a different domain name to avoid
|
||||
-- sending cookies.
|
||||
urlRenderOverride :: a -> Routes a -> Maybe String
|
||||
urlRenderOverride _ _ = Nothing
|
||||
urlRenderOverride :: Routes a -> Maybe String
|
||||
urlRenderOverride _ = Nothing
|
||||
|
||||
-- | Determine is a request is authorized or not.
|
||||
-- | Determine if a request is authorized or not.
|
||||
--
|
||||
-- Return 'Nothing' is the request is authorized, 'Just' a message if
|
||||
-- unauthorized. If authentication is required, you should use a redirect;
|
||||
-- the Auth helper provides this functionality automatically.
|
||||
isAuthorized :: a -> Routes a -> IO (Maybe String)
|
||||
isAuthorized _ _ = return Nothing
|
||||
isAuthorized :: Routes a -> Handler a (Maybe String)
|
||||
isAuthorized _ = return Nothing
|
||||
|
||||
-- | A type-safe, concise method of creating breadcrumbs for pages. For each
|
||||
-- resource, you declare the title of the page and the parent resource (if
|
||||
|
||||
Loading…
Reference in New Issue
Block a user