Class: Actions::Middleware::RemoteAction

Inherits:
Dynflow::Middleware
  • Object
show all
Defined in:
app/lib/actions/middleware/remote_action.rb

Overview

Helpers for remote actions wraps the plan/run/finalize methods to include the info about the user that triggered the action.

Instance Method Summary collapse

Instance Method Details

#finalizeObject



19
20
21
# File 'app/lib/actions/middleware/remote_action.rb', line 19

def finalize
  as_remote_user { pass }
end

#plan(*args) ⇒ Object



7
8
9
10
11
12
13
# File 'app/lib/actions/middleware/remote_action.rb', line 7

def plan(*args)
  fail "No current user is set. Please set User.current to perform a remote action" if User.current.nil?
  pass(*args).tap do
    action.input[:remote_user] = User.remote_user
    action.input[:remote_cp_user] = User.remote_user
  end
end

#run(*args) ⇒ Object



15
16
17
# File 'app/lib/actions/middleware/remote_action.rb', line 15

def run(*args)
  as_remote_user { pass(*args) }
end