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

Michael Snoyman michael at snoyman.com
Mon Jan 16 13:59:23 CET 2012


On Mon, Jan 16, 2012 at 2:14 PM, Felipe Almeida Lessa
<felipe.lessa at gmail.com> wrote:
> Hello, everyone!
>
> I'm going to try creating a blog and my first post is dedicated to how
> I am writing my isAuthorized function:
>
> http://blog.felipe.lessa.nom.br/?p=7
>
> I'd be thrilled if you could tell me if you like the idea!  Something
> similar could be done on Yesod 0.10, either on yesod-core or on the
> scaffold.  I didn't try writing some generic code yet because I'd like
> to gather comments here first.
>
> Cheers, =)
>
> --
> Felipe.

I like it. I could imagine a setup like this:

class YesodPermissions master where
    data Permission master
    hasPermissionTo :: ...
    ...

isAuthorizedPermissions :: YesodPermissions master => Route master ->
Bool -> GHandler sub master AuthorizationResult

It could sit next to YesodBreadcrumbs in Yesod.Core as a "you don't
*have* to use it, but it's really convenient to do so."

Michael



More information about the web-devel mailing list