class Sqreen::Rules::RunUserActions

Runs the block_user actions (for hooking Sqreen.{identify,auth_user})

Public Class Methods

new(klass, method, auth_keys_idx) click to toggle source
Calls superclass method Sqreen::CB::new
# File lib/sqreen/rules/run_user_actions.rb, line 13
def initialize(klass, method, auth_keys_idx)
  super(klass, method)
  @auth_keys_idx = auth_keys_idx
end

Public Instance Methods

post(_retval, _inst, args, _budget = nil) click to toggle source
# File lib/sqreen/rules/run_user_actions.rb, line 18
def post(_retval, _inst, args, _budget = nil)
  actions = actions_repo.get('block_user', args[@auth_keys_idx]) +
            actions_repo.get('redirect_user', args[@auth_keys_idx])

  actions.each do |action|
    res = action.run args[@auth_keys_idx]
    return res unless res.nil?
  end
  nil
end

Private Instance Methods

actions_repo() click to toggle source

@return [Sqreen::Actions::Repository]

# File lib/sqreen/rules/run_user_actions.rb, line 32
def actions_repo
  Sqreen::Actions::Repository.current
end