soar-registry-identity 6.0.1 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d74255d5ef004f45a6ff993c3e091fe0ce25642
4
- data.tar.gz: 070ab8ac8d2dc8ac7661b4c4d362e3761b2a559e
3
+ metadata.gz: 10f0efeadba1d01ba72267399bc2b98a7f4ef13b
4
+ data.tar.gz: 65c52117a4e8e37067b89b465cf2d99f638c6ec7
5
5
  SHA512:
6
- metadata.gz: ee3aca71e277683eff3f11aaddaabbbe084f23abcf8dbc891562a75053638a2048a27fab4364b4adf730518b4e4d049b368be8f23cd37e6353629706253abe3d
7
- data.tar.gz: e966b1a027bedfeb919cf51e88d85e7495aec640e6d1d1fac3f1ff3f53a26f5e52fa5249c7b1e95088cd44828e0a74929b932a544d61c5ac2e569fd7418e1d79
6
+ metadata.gz: 7dc27e5c24f2d7c5b6148267aae94b49a752da2cf435b9016c7df26f2b35819487029c74bf373c4957b6458f814a344d0e35941137ed666de2a661df85bec8b0
7
+ data.tar.gz: c219b916b9fb7e90f5169fced8616f128bc02529e4b747014a9a5723157111b5498eccecceee148bee6e704181b17175e6669fb576ceebb6da5c84fa541dc75b
@@ -0,0 +1,21 @@
1
+
2
+ module Soar
3
+ module Registry
4
+ module Identity
5
+ class Directory
6
+
7
+ attr_reader :directory, :fetch_index, :search_index
8
+
9
+ # @param [Soar::Registry::Directory] directory
10
+ # @param [String, Array] fetch_index
11
+ # @param [String, Array] search_index
12
+ def initialize(directory:, fetch_index:, search_index:)
13
+ @directory = directory
14
+ @fetch_index = fetch_index
15
+ @search_index = search_index
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
@@ -4,6 +4,7 @@ require 'soar/registry/identity/provider/customer/client_number'
4
4
  require 'soar/registry/identity/provider/customer/email'
5
5
  require 'soar/registry/identity/provider/customer/uuid'
6
6
  require 'soar/registry/identity/provider/stub/uuid'
7
+ require 'soar/registry/identity/directory'
7
8
 
8
9
  module Soar
9
10
  module Registry
@@ -6,29 +6,15 @@ module Soar
6
6
  module Provider
7
7
  module Customer
8
8
 
9
- ##
10
- # Work in progress. Do not use.
11
- ##
12
9
  class Uuid < SoarIdm::IdmApi
13
10
 
14
11
  ##
15
- # @param [Hash] identity
16
- # @option identity [Soar::Registry::Directory] :directory
17
- # @option identity [String] :fetch_index
18
- # @option identity [String] :search_index
19
- #
20
- # @param [Hash] roles
21
- # @option roles [Soar::Registry::Directory] :directory
22
- # @option roles [String] :fetch_index
23
- # @option roles [String] :search_index
24
- #
25
- # @raise [ArgumentError]
12
+ # @param [Soar::Registry::Identity::Directory] identity_directory
13
+ # @param [Soar::Registry::Identity::Directory] role_directory
26
14
  ##
27
- def initialize(identity:, roles:)
28
- raise ArgumentError if not identity.key?(:directory) or not identity.key?(:fetch_index) or not identity.key?(:search_index)
29
- raise ArgumentError if not roles.key?(:directory) or not roles.key?(:fetch_index) or not roles.key?(:search_index)
30
- @identity = identity
31
- @roles = roles
15
+ def initialize(identity_directory:, role_directory:)
16
+ @identity_directory = identity_directory
17
+ @role_directory = role_directory
32
18
  end
33
19
 
34
20
  ##
@@ -36,10 +22,10 @@ module Soar
36
22
  # @return [Array<String>] list of roles
37
23
  ##
38
24
  def calculate_roles(identity_uuid)
39
- entries = @roles[:directory].search(@roles[:search_index], identity_uuid)
25
+ entries = @role_directory.directory.search(@role_directory.search_index, identity_uuid)
40
26
  roles = []
41
27
  entries.each do |entry|
42
- roles << entry[@roles[:fetch_index][1]]
28
+ roles << entry[@role_directory.fetch_index[1]]
43
29
  end
44
30
  return roles
45
31
  end
@@ -49,13 +35,13 @@ module Soar
49
35
  # @return [Array<String,Number>] list of identifiers
50
36
  ##
51
37
  def calculate_identifiers(identity_uuid)
52
- indexes = @identity[:directory].index
53
- #indexes.delete(@identity[:directory])
38
+ indexes = @identity_directory.directory.index
39
+ #indexes.delete(@identity_directory.directory)
54
40
  identifiers = []
55
41
  indexes.each { |index|
56
42
  identifiers << identity[index.to_s]
57
43
  }
58
- identifiers << identity[@roles[:fetch_index][0]]
44
+ identifiers << identity[@role_directory.fetch_index[0]]
59
45
  return identifiers.reverse
60
46
  end
61
47
 
@@ -66,10 +52,10 @@ module Soar
66
52
  ##
67
53
  def calculate_attributes(identity_uuid, role)
68
54
  primary_key = {
69
- @roles[:fetch_index][0] => identity_uuid,
70
- @roles[:fetch_index][1] => role
55
+ @role_directory.fetch_index[0] => identity_uuid,
56
+ @role_directory.fetch_index[1] => role
71
57
  }
72
- result = @roles[:directory].fetch(primary_key)
58
+ result = @role_directory.directory.fetch(primary_key)
73
59
  attributes = {
74
60
  role => result.key?('identity_role_attributes') ? result['identity_role_attributes'] : {}
75
61
  }
@@ -81,7 +67,7 @@ module Soar
81
67
  # @return [Hash{String => String, Number, Hash, Array}] A hash of attributes
82
68
  def calculate_all_attributes(identity_uuid)
83
69
  identity = {}
84
- role_entries = @roles[:directory].search(@roles[:search_index], identity_uuid)
70
+ role_entries = @role_directory.directory.search(@role_directory.search_index, identity_uuid)
85
71
  roles = {}
86
72
  role_entries.each do |role_entry|
87
73
  identity = calculate_identity(identity_uuid, role_entry['identity_source']) if role_entry.key?('identity_source')
@@ -102,7 +88,7 @@ module Soar
102
88
  identity_id = get_identity_id(identity_source) if not identity_source.nil?
103
89
  #raise SoarIdm::IdentityError if identity_id.nil?
104
90
  begin
105
- source_identity = @identity[:directory].fetch(identity_id)
91
+ source_identity = @identity_directory.directory.fetch(identity_id)
106
92
  identity = {}
107
93
  identity["identity_uuid"] = identity_uuid
108
94
  identity["email"] = source_identity['Notifyemail_Invoice'] if source_identity.key?('Notifyemail_Invoice')
@@ -9,23 +9,12 @@ module Soar
9
9
  class Uuid < SoarIdm::IdmApi
10
10
 
11
11
  ##
12
- # @param [Hash] identity
13
- # @option identity [Soar::Registry::Directory] :directory
14
- # @option identity [String] :fetch_index
15
- # @option identity [String] :search_index
16
- #
17
- # @param [Hash] roles
18
- # @option roles [Soar::Registry::Directory] :directory
19
- # @option roles [String] :fetch_index
20
- # @option roles [String] :search_index
21
- #
22
- # @raise [ArgumentError]
12
+ # @param [Soar::Registry::Directory] identity_directory
13
+ # @param [Soar::Registry::Directory] role_directory
23
14
  ##
24
- def initialize(identity:, roles:)
25
- raise ArgumentError if not identity.key?(:directory) or not identity.key?(:fetch_index) or not identity.key?(:search_index)
26
- raise ArgumentError if not roles.key?(:directory) or not roles.key?(:fetch_index) or not roles.key?(:search_index)
27
- @identity = identity
28
- @roles = roles
15
+ def initialize(identity_directory:, role_directory:)
16
+ @identity_directory = identity_directory
17
+ @role_directory = role_directory
29
18
  end
30
19
 
31
20
  ##
@@ -33,11 +22,11 @@ module Soar
33
22
  # @return [Array<String>] list of roles
34
23
  ##
35
24
  def calculate_roles(identity_uuid)
36
- entries = @roles[:directory].search(@roles[:search_index], identity_uuid)
25
+ entries = @role_directory.directory.search(@role_directory.search_index, identity_uuid)
37
26
  roles = []
38
27
  entries.each do |entry|
39
28
  identity_source = entry['identity_source'] if entry.key?('identity_source')
40
- roles << entry[@roles[:fetch_index][1]]
29
+ roles << entry[@role_directory.fetch_index[1]]
41
30
  end
42
31
  return roles
43
32
  end
@@ -47,7 +36,7 @@ module Soar
47
36
  # @return [Array<String,Number>] list of identifiers
48
37
  ##
49
38
  def calculate_identifiers(identity)
50
- indexes = @identity[:directory].index
39
+ indexes = @identity_directory.directory.index
51
40
  identifiers = []
52
41
  indexes.each { |index|
53
42
  identifiers << identity[index.to_s]
@@ -62,10 +51,10 @@ module Soar
62
51
  ##
63
52
  def calculate_attributes(identity_uuid, role)
64
53
  primary_key = {
65
- @roles[:fetch_index][0] => identity_uuid,
66
- @roles[:fetch_index][1] => role
54
+ @role_directory.fetch_index[0] => identity_uuid,
55
+ @role_directory.fetch_index[1] => role
67
56
  }
68
- result = @roles[:directory].fetch(primary_key)
57
+ result = @role_directory.directory.fetch(primary_key)
69
58
  attributes = {
70
59
  role => result.key?('identity_role_attributes') ? result['identity_role_attributes'] : {}
71
60
  }
@@ -78,12 +67,12 @@ module Soar
78
67
  ##
79
68
  def calculate_all_attributes(identity_uuid)
80
69
  begin
81
- role_entries = @roles[:directory].search(@roles[:search_index], identity_uuid)
70
+ role_entries = @role_directory.directory.search(@role_directory.search_index, identity_uuid)
82
71
  roles = {}
83
72
  role_entries.each { |role_entry|
84
73
  roles[role_entry['identity_role']] = role_entry.key?('identity_role_attributes') ? role_entry['identity_role_attributes'] : {}
85
74
  }
86
- identity = @identity[:directory].fetch(identity_uuid)
75
+ identity = @identity_directory.directory.fetch(identity_uuid)
87
76
  attributes = {}
88
77
  attributes["identity_uuid"] = identity_uuid
89
78
  attributes["firstname"] = identity['givenName'] if identity.key?('givenName')
@@ -68,16 +68,16 @@ module Soar
68
68
 
69
69
  def given_identity_registry
70
70
  identity_provider = Soar::Registry::Identity::Provider::Customer::Uuid.new({
71
- identity: {
71
+ identity_directory: Soar::Registry::Identity::Directory.new({
72
72
  directory: @identity_directory,
73
73
  fetch_index: 'ID',
74
74
  search_index: 'Notifyemail_Invoice'
75
- },
76
- roles: {
75
+ }),
76
+ role_directory: Soar::Registry::Identity::Directory.new({
77
77
  directory: @roles_directory,
78
78
  fetch_index: ['identity_uuid', 'identity_role'],
79
79
  search_index: 'identity_uuid'
80
- }
80
+ })
81
81
  })
82
82
 
83
83
  @idr = Soar::Registry::Identity.new(identity_provider)
@@ -75,16 +75,16 @@ module Soar
75
75
 
76
76
  def given_identity_registry
77
77
  identity_provider = Soar::Registry::Identity::Provider::Staff::Uuid.new({
78
- identity: {
78
+ identity_directory: Soar::Registry::Identity::Directory.new({
79
79
  directory: @identity_directory,
80
80
  fetch_index: 'entryuuid',
81
81
  search_index: 'mail'
82
- },
83
- roles: {
82
+ }),
83
+ role_directory: Soar::Registry::Identity::Directory.new({
84
84
  directory: @roles_directory,
85
85
  fetch_index: ['identity_uuid', 'identity_role'],
86
86
  search_index: 'identity_uuid'
87
- }
87
+ })
88
88
  })
89
89
 
90
90
  @idr = Soar::Registry::Identity.new(identity_provider)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soar-registry-identity
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Mulder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-30 00:00:00.000000000 Z
11
+ date: 2017-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: soar_idm
@@ -66,6 +66,7 @@ files:
66
66
  - features/step_definitions/get_role_attributes_by_uuid.rb
67
67
  - features/step_definitions/get_roles_by_uuid_steps.rb
68
68
  - lib/soar/registry/identity.rb
69
+ - lib/soar/registry/identity/directory.rb
69
70
  - lib/soar/registry/identity/error.rb
70
71
  - lib/soar/registry/identity/factory.rb
71
72
  - lib/soar/registry/identity/model.rb
@@ -101,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
102
  version: '0'
102
103
  requirements: []
103
104
  rubyforge_project:
104
- rubygems_version: 2.5.2
105
+ rubygems_version: 2.5.1
105
106
  signing_key:
106
107
  specification_version: 4
107
108
  summary: Identity Registry