Given the next model using the aasm gem:
class Job
  include AASM
  aasm do
    state :sleeping, :initial => true
    state :running, :cleaning
    event :run do
      transitions :from => :sleeping, :to => :running
    end
    event :clean do
      transitions :from => :running, :to => :cleaning
    end
    event :sleep do
      transitions :from => [:running, :cleaning], :to => :sleeping
    end
  end
end
I have 2 types of users on my web application (regular users, and super users). I need super users type, beeing able to call the event they want. Like calling #run on a job with state=cleaning.
So, as I understand, what I need is to resolve the transition's from at runtime. If the user is a superuser, the from would be all the states, but if the user is not a super user, each from would have different states.
Is there any clean way to do that? Do you have any ideas?
 
     
    