Hey,
First of all - @Brian - I apologise for double sending this to you..
since can only reply to author, now Cc-ing the group email as well..
Ok, question as follows:
I'm using Restful_Authentication plugin (generated authenticated user
sessions with --include-activation and --aasm) and the
Declarative_Authorization plugin..
I'm quite a beginner, so my question might be very basic..
wanted to know if there's a way to authorize AASM's trasitions?
To begin with, how should I handle authorization for the state
transitions (or aasm_event s) of AasmRoles of User
(:active, :passive, :pending, :suspended, :unsuspended, :deleted)? and
where should this be done exactly?
Thank you :)
tino.
On Jan 22, 7:47 am, Brian Hughes <fogg...@gmail.com> wrote:
> If you are using state_machine, this kind of thing is pretty
> straightforward. What you want to do is define a before_transition
> rule that calls a method in your model (I recommend a private method,
> for this, with a name ending in ?). Have that method return true when
> you want to allow thetransition, or false when you don't.
> State_machine will handle the rest and set an error message on your
> model object.
>
> You can also set your own errors, in the method that the
> before_transition calls, when you are going to return false.
>
> -Brian
>
> On Jan 21, 4:51 am, "H.j. Blok" <li...@ruby-forum.com> wrote:
>
> > Does anybody know how to authorizestatetransitions? I'm using
> > state_machine in my rails app to define thestateof an Article
> > (published or unpublished). I'm also using declarative_authorization to
> > determine the authorizations a user has. But how do I authorize astate
> > transistion (determine if the user has the right to publish the
> > Article)?
>
> > Kind regards,
>
> > H.J. Blok
> > --
> > Posted viahttp://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment