Class: Sqreen::Actions::UsersIndex

Inherits:
ActionsIndex show all
Defined in:
lib/sqreen/actions/users_index.rb

Instance Method Summary collapse

Instance Method Details

#actions_matching(identity_params) ⇒ Object



11
12
13
14
15
16
# File 'lib/sqreen/actions/users_index.rb', line 11

def actions_matching(identity_params)
  return [] unless @idx
  key = stringify_keys(identity_params)
  actions = @idx[key]
  actions || []
end

#index(params, action) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sqreen/actions/users_index.rb', line 18

def index(params, action)
  @idx ||= {}
  users = params['users']
  raise ::Sqreen::Exception, 'nil "users" param for block_user action' if users.nil?
  raise ::Sqreen::Exception, '"users" param must be an array' unless users.is_a? Array

  users.each do |u|
    @idx[u] ||= []
    @idx[u] << action
  end
end