Class: Soar::Registry::Identity::Provider::Staff::Base
- Inherits:
-
SoarIdm::IdmApi
- Object
- SoarIdm::IdmApi
- Soar::Registry::Identity::Provider::Staff::Base
- Defined in:
- lib/soar/registry/identity/provider/staff/base.rb
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#translator ⇒ Object
readonly
Returns the value of attribute translator.
Instance Method Summary collapse
-
#calculate_all_attributes(identity) ⇒ Hash
Hash of attributes keyed by role.
-
#calculate_attributes(identity, role) ⇒ Hash
A hash of attributes.
-
#calculate_identifiers(identity) ⇒ Array
List of identifiers.
-
#calculate_roles(identity) ⇒ Array
List of roles.
-
#initialize(directory: nil) ⇒ Base
constructor
A new instance of Base.
Constructor Details
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
11 12 13 |
# File 'lib/soar/registry/identity/provider/staff/base.rb', line 11 def directory @directory end |
#translator ⇒ Object (readonly)
Returns the value of attribute translator.
12 13 14 |
# File 'lib/soar/registry/identity/provider/staff/base.rb', line 12 def translator @translator end |
Instance Method Details
#calculate_all_attributes(identity) ⇒ Hash
Returns Hash of attributes keyed by role.
65 66 67 68 |
# File 'lib/soar/registry/identity/provider/staff/base.rb', line 65 def calculate_all_attributes(identity) entry = @directory.fetch(identity[@directory.index[0]]) @translator.get_identity(entry) end |
#calculate_attributes(identity, role) ⇒ Hash
Returns A hash of attributes.
55 56 57 58 59 60 |
# File 'lib/soar/registry/identity/provider/staff/base.rb', line 55 def calculate_attributes(identity, role) entry = @directory.fetch(identity[@directory.index[0]]) return nil if not entry identity = @translator.get_identity(entry) { role => identity['roles'][role] } end |
#calculate_identifiers(identity) ⇒ Array
Returns list of identifiers.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/soar/registry/identity/provider/staff/base.rb', line 40 def calculate_identifiers(identity) indexes = @directory.index entry = @directory.fetch(identity[@directory.index[0]]) identity = @translator.get_identity(entry) identifiers = [] indexes.each { |index| identifiers << identity[index] } identifiers end |
#calculate_roles(identity) ⇒ Array
Returns list of roles.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/soar/registry/identity/provider/staff/base.rb', line 25 def calculate_roles(identity) entry = @directory.fetch(identity[@directory.index[0]]) return nil if not entry identity = @translator.get_identity(entry) roles = [] identity['roles'].each do |role, attributes| roles << role end roles end |