[web-devel] [Yesod] Re: Abstracting permissions with Yesod

Felipe Almeida Lessa felipe.lessa at gmail.com
Mon Aug 27 15:15:01 CEST 2012


On Mon, Aug 27, 2012 at 5:52 AM, Arthur Clemens <arthurclemens at gmail.com> wrote:
> Did something change in Yesod?
> This part doesn't seem to work:
>
> isAuthorized route isWrite = do
>   mauth <- maybeAuth
>   runDB $ mauth `isAuthorizedTo` permissionsRequiredFor route isWrite
>
> Returns
>
> Foundation.hs:109:20:
>     Couldn't match expected type `(UserId, User)'
>                 with actual type `Entity val0'

To fix this bug you'll need to change all '(UserId, User)'s into
'Entity User's.  For example:

hasPermissionTo :: Entity User
                -> Permission
                -> YesodDB sub Blog AuthResult
(Entity _ user) `hasPermissionTo` Post = ...

etc.  I'm not sure if there's anything else missing.

Cheers, =)

-- 
Felipe.



More information about the web-devel mailing list