Module: AuthLh::UserManagement::ClassMethods

Defined in:
lib/auth_lh/user_management.rb

Instance Method Summary collapse

Instance Method Details

#all_externalObject



24
25
26
# File 'lib/auth_lh/user_management.rb', line 24

def all_external
  @cached_users ||= auth_api.get_users({ pagination: 'false' })
end

#all_external_with_all_roles(role_ids) ⇒ Object



38
39
40
41
42
# File 'lib/auth_lh/user_management.rb', line 38

def all_external_with_all_roles(role_ids)
  all_external.find_all { |x|
    role_ids.any? { |role_id| x.has_all_roles?(role_id) }
  }
end

#all_external_with_role(role_id) ⇒ Object



28
29
30
# File 'lib/auth_lh/user_management.rb', line 28

def all_external_with_role(role_id)
  all_external.find_all { |x| x.has_role?(role_id) }
end

#all_external_with_some_role(role_ids) ⇒ Object



32
33
34
35
36
# File 'lib/auth_lh/user_management.rb', line 32

def all_external_with_some_role(role_ids)
  all_external.find_all { |x|
    role_ids.any? { |role_id| x.has_some_role?(role_id) }
  }
end

#clear_cache!Object



72
73
74
# File 'lib/auth_lh/user_management.rb', line 72

def clear_cache!
  @cached_users = nil
end

#find_external(login) ⇒ Object



44
45
46
# File 'lib/auth_lh/user_management.rb', line 44

def find_external()
  all_external.find { |x| x. == .to_s }
end

#find_external_with_all_roles(role_ids) ⇒ Object



56
57
58
# File 'lib/auth_lh/user_management.rb', line 56

def find_external_with_all_roles(role_ids)
  all_external_with_all_roles(role_ids).first
end

#find_external_with_role(role_id) ⇒ Object



48
49
50
# File 'lib/auth_lh/user_management.rb', line 48

def find_external_with_role(role_id)
  all_external_with_role(role_id).first
end

#find_external_with_some_role(role_ids) ⇒ Object



52
53
54
# File 'lib/auth_lh/user_management.rb', line 52

def find_external_with_some_role(role_ids)
  all_external_with_some_role(role_ids).first
end

#with_all_roles(role_ids) ⇒ Object



68
69
70
# File 'lib/auth_lh/user_management.rb', line 68

def with_all_roles(role_ids)
  all.to_a.find_all { |x| x.has_all_roles?(role_ids) }
end

#with_role(role_id) ⇒ Object



60
61
62
# File 'lib/auth_lh/user_management.rb', line 60

def with_role(role_id)
  all.to_a.find_all { |x| x.has_role?(role_id) }
end

#with_some_role(role_ids) ⇒ Object



64
65
66
# File 'lib/auth_lh/user_management.rb', line 64

def with_some_role(role_ids)
  all.to_a.find_all { |x| x.has_some_role?(role_ids) }
end