Module: AdGear::Infrastructure::GroupManager::Config

Includes:
Logging
Included in:
App, LDAP, Utils
Defined in:
lib/config.rb

Overview

Since:

  • 0.1.0

Constant Summary collapse

GLOBAL_CONFIG =

The global config instance rubocop:disable Style/MutableConstant

Since:

  • 0.1.0

{
  data: {
    locations: {},
    organizational: {},
    functional: {},
    permissions: {}
  }
}

Constants included from Logging

Logging::Log

Class Method Summary collapse

Methods included from Logging

fatal

Class Method Details

.list_all_groupsObject

Lists all the groups

Since:

  • 0.1.0



67
68
69
70
71
72
73
# File 'lib/config.rb', line 67

def list_all_groups
  newobj = {}
  GLOBAL_CONFIG[:data].each do |_k, v|
    newobj.merge!(v)
  end
  newobj
end

.list_func_groupsObject

List all funcitonal groups defined in local configuration

Since:

  • 1.0.0



89
90
91
# File 'lib/config.rb', line 89

def list_func_groups
  GLOBAL_CONFIG[:data][:functional]
end

.list_locationsObject

List all location groups defined in local configuration.

Since:

  • 0.1.0



95
96
97
# File 'lib/config.rb', line 95

def list_locations
  GLOBAL_CONFIG[:data][:locations]
end

.list_org_groupsObject

List all organizational groups defined in local configuration.

Since:

  • 0.1.0



77
78
79
# File 'lib/config.rb', line 77

def list_org_groups
  GLOBAL_CONFIG[:data][:organizational]
end

.list_perm_groupsObject

List all organizational groups defined in local configuration.

Since:

  • 0.1.0



83
84
85
# File 'lib/config.rb', line 83

def list_perm_groups
  GLOBAL_CONFIG[:data][:permissions]
end

.list_usersObject

List all users defined in local configuration.

Since:

  • 0.1.0



101
102
103
104
105
106
107
108
109
110
111
# File 'lib/config.rb', line 101

def list_users
  users = []
  list_all_groups.each do |_k, v|
    next if v.nil?
    next unless v.key?('member')
    next if v['member'].nil?

    users += v['member']
  end
  users = users.uniq.sort - list_all_groups.keys
end