You're technically right. That's what we call "roll your own" =)



El sáb, 08-08-2009 a las 23:46 -0500, Roy Wright escribió:
> First, I haven't used warden (this thread brought it to my
> attention).  
> 
> 
> Under "The How" section on the overview page, it states:
> 
> 
> After authentication is performed. If it is successful it will provide
> access to the “user” object. This can be anything except nil.
> 
> 
>   env['warden'].authenticate(:password)
>   env['warden'].user # the user object 
> 
> If I'm understanding this correctly, then the user object could be a User 
> model instance that has a reference to a Role model:
> class User
>   property :name, String
>   belongs_to :role
>   ...
> end
> class Role
>   property :name, String
>   has n, :users
>   ...
> end
> 
> 
> So now you could check for roles with:
> 
> 
> env['warden'].user.role == 'admin'
> 
> You might have to manually set the user to the User instance in your 
> authentication strategy, I'm not real clear on that detail.
> 
> Have fun,
> Roy
> 
> 
> On Aug 8, 2009, at 10:33 AM, Nicholas Orr wrote:
> 
> > Hmm having read the wiki page again (last time i read was a couple
> > months ago), yes it appears that warden is auth only too. oops.
> > 
> > Nick
> > 
> > On Sun, Aug 9, 2009 at 1:20 AM, programmerjorge
> > <[email protected]> wrote:
> >         Doesn't Warden only handle authentication as well?
> >         
> >         
> >         
> >         On Sat, Aug 8, 2009 at 10:10 AM, Nicholas Orr
> >         <[email protected]> wrote:
> >                 Have a look at Warden?
> >                 http://wiki.github.com/hassox/warden
> >                 
> >                 merb-auth works well enough for the authuneticate
> >                 part - merb-auth doesn't do authorisation though.
> >                 
> >                 Nick :)
> >                 
> >                 On Sat, Aug 8, 2009 at 12:39 PM, Christian Hoeppner
> >                 <[email protected]> wrote:
> >                         
> >                         Hey
> >                         
> >                         So, I need some authorization for my app.
> >                         I've been cooking around with
> >                         some self-built role-based approach, but
> >                         it's quickly getting out of
> >                         comtrol. I will have to dedicate some extra
> >                         time to this. But for now...
> >                         is there any plugin, piece of code, etc...
> >                         that I could use?
> >                         
> >                         A quick google dug up nothing too
> >                         interesting. I found two plugins, one
> >                         of which is deemed as "sucks" by the author,
> >                         and the other one looks
> >                         like a weekend job, and that's about as much
> >                         as I found.
> >                         
> >                         Any hints are greatly apreciated.
> >                         
> >                         
> >                         
> >                 
> >                 
> >                 
> >         
> >         
> >         
> >         
> > 
> > 
> > 
> > 
> 
> 
> 
> > 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to