soar-registry-identity 5.0.2 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/soar/registry/identity/provider/customer/uuid.rb +5 -6
- data/lib/soar/registry/identity/provider/staff/uuid.rb +3 -4
- data/lib/soar/registry/identity/test/orchestration_provider/customer/uuid.rb +22 -22
- data/lib/soar/registry/identity/test/orchestration_provider/staff/uuid.rb +26 -26
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76cb81c870c7512a071ef0d9aecb4e0ad9bbac2b
|
4
|
+
data.tar.gz: c4614569d7cc44d86ef6896bb383d88b511c072c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '02285d3db306fb50b1e030927eff663ff27c3ab082cae04f268a50353e60029d1b384a9e09159384e8ff464b9fcec50cd30a2d1e3240359d184d2f59aea3c220'
|
7
|
+
data.tar.gz: aaf2a6134a659f5e71edb578ef150bb6601288cd6c35578e3be94635d575d5e8c14fe6e629bbcc95775fdb751b187bc6c1262d715e13778e3977ae40e19a4a7c
|
@@ -88,9 +88,8 @@ module Soar
|
|
88
88
|
roles[role_entry['identity_role']] = role_entry.key?('identity_role_attributes') ? role_entry['identity_role_attributes'] : {}
|
89
89
|
end
|
90
90
|
raise SoarIdm::IdentityError if identity.empty?
|
91
|
-
identity[
|
92
|
-
|
93
|
-
return attributes
|
91
|
+
identity['roles'] = roles
|
92
|
+
return identity
|
94
93
|
end
|
95
94
|
|
96
95
|
##
|
@@ -106,9 +105,9 @@ module Soar
|
|
106
105
|
source_identity = @identity[:directory].fetch(identity_id)
|
107
106
|
identity = {}
|
108
107
|
identity["identity_uuid"] = identity_uuid
|
109
|
-
identity["email"] = source_identity[
|
110
|
-
identity["firstname"] = source_identity[
|
111
|
-
identity["lastname"] = source_identity[
|
108
|
+
identity["email"] = source_identity['Notifyemail_Invoice'] if source_identity.key?('Notifyemail_Invoice')
|
109
|
+
identity["firstname"] = source_identity['First_Name'] if source_identity.key?('First_Name')
|
110
|
+
identity["lastname"] = source_identity['Surname'] if source_identity.key?('Surname')
|
112
111
|
return identity
|
113
112
|
rescue Soar::Registry::Directory::Error::NoEntriesFoundError => e
|
114
113
|
raise SoarIdm::IdentityError, e.message
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'soar_idm/soar_idm'
|
2
|
-
require 'hashie'
|
3
2
|
|
4
3
|
module Soar
|
5
4
|
module Registry
|
@@ -87,9 +86,9 @@ module Soar
|
|
87
86
|
identity = @identity[:directory].fetch(identity_uuid)
|
88
87
|
attributes = {}
|
89
88
|
attributes["identity_uuid"] = identity_uuid
|
90
|
-
attributes["firstname"] = identity[
|
91
|
-
attributes["lastname"] = identity[
|
92
|
-
attributes["email"] = identity[
|
89
|
+
attributes["firstname"] = identity['givenName'] if identity.key?('givenName')
|
90
|
+
attributes["lastname"] = identity['sn'] if identity.key?('sn')
|
91
|
+
attributes["email"] = identity['mail'] if identity.key?('mail')
|
93
92
|
attributes["roles"] = roles
|
94
93
|
return attributes
|
95
94
|
rescue Soar::Registry::Directory::Error::NoEntriesFoundError => e
|
@@ -15,13 +15,13 @@ module Soar
|
|
15
15
|
def initialize
|
16
16
|
Faker::UniqueGenerator.clear
|
17
17
|
@identity = {
|
18
|
-
ID
|
19
|
-
First_Name
|
20
|
-
Surname
|
21
|
-
Notifyemail_Invoice
|
22
|
-
Client_Number
|
18
|
+
"ID" => Faker::Number.unique.number(4).to_i,
|
19
|
+
"First_Name" => Faker::Name.unique.first_name,
|
20
|
+
"Surname" => Faker::Name.unique.last_name,
|
21
|
+
"Notifyemail_Invoice" => "#{Faker::Internet.unique.email}",
|
22
|
+
"Client_Number" => "C#{Faker::Number.unique.number(10)}"
|
23
23
|
}
|
24
|
-
@identity_uuid = Soar::Authentication::IdentityUuidTranslator::UuidGenerator.generate("#{Soar::Authentication::IdentityUuidTranslator::Provider::Customer::PREFIX}#{@identity[
|
24
|
+
@identity_uuid = Soar::Authentication::IdentityUuidTranslator::UuidGenerator.generate("#{Soar::Authentication::IdentityUuidTranslator::Provider::Customer::PREFIX}#{@identity['ID']}")
|
25
25
|
end
|
26
26
|
|
27
27
|
def given_identity_directory
|
@@ -50,8 +50,8 @@ module Soar
|
|
50
50
|
|
51
51
|
def given_role_with_attributes
|
52
52
|
@roles = generate_roles()
|
53
|
-
@roles[0][
|
54
|
-
profiles
|
53
|
+
@roles[0]['attributes'] = {
|
54
|
+
'profiles' => [@identity['Client_Number'], "C#{Faker::Number.unique.number(10)}"]
|
55
55
|
}
|
56
56
|
wait_for_database {
|
57
57
|
create_roles_table(@roles_directory, @roles_directory_config)
|
@@ -90,7 +90,7 @@ module Soar
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def get_role_attributes
|
93
|
-
@result = @idr.get_attributes(@identity_uuid, @roles.nil? ? Faker::Company.unique.profession : @roles[0][
|
93
|
+
@result = @idr.get_attributes(@identity_uuid, @roles.nil? ? Faker::Company.unique.profession : @roles[0]['role'])
|
94
94
|
end
|
95
95
|
|
96
96
|
def get_identity_attributes
|
@@ -106,13 +106,13 @@ module Soar
|
|
106
106
|
def identity_attributes?
|
107
107
|
roles = {}
|
108
108
|
@roles.each do |entry|
|
109
|
-
roles[entry[
|
109
|
+
roles[entry['role']] = {}
|
110
110
|
end if not @roles.nil?
|
111
111
|
expectation = {
|
112
112
|
"identity_uuid" => @identity_uuid,
|
113
|
-
"firstname" => @identity[
|
114
|
-
"lastname" => @identity[
|
115
|
-
"email" => @identity[
|
113
|
+
"firstname" => @identity['First_Name'],
|
114
|
+
"lastname" => @identity['Surname'],
|
115
|
+
"email" => @identity['Notifyemail_Invoice'],
|
116
116
|
"roles" => roles
|
117
117
|
}
|
118
118
|
@result == expectation
|
@@ -124,20 +124,20 @@ module Soar
|
|
124
124
|
|
125
125
|
def role_with_empty_attributes?
|
126
126
|
@result == {
|
127
|
-
@roles[0][
|
127
|
+
@roles[0]['role'] => {}
|
128
128
|
}
|
129
129
|
end
|
130
130
|
|
131
131
|
def role_with_attributes?
|
132
132
|
role_with_attributes = {
|
133
|
-
@roles[0][
|
133
|
+
@roles[0]['role'] => Hashie.stringify_keys(@roles[0]['attributes'])
|
134
134
|
}
|
135
135
|
@result == role_with_attributes
|
136
136
|
end
|
137
137
|
|
138
138
|
def roles?
|
139
139
|
roles = @roles.map do |entry|
|
140
|
-
entry[
|
140
|
+
entry['role']
|
141
141
|
end
|
142
142
|
@result.sort == roles.sort
|
143
143
|
end
|
@@ -154,10 +154,10 @@ module Soar
|
|
154
154
|
|
155
155
|
def generate_roles()
|
156
156
|
return [{
|
157
|
-
source
|
158
|
-
role
|
157
|
+
'source' => "#{Soar::Authentication::IdentityUuidTranslator::Provider::Customer::PREFIX}#{@identity['ID']}",
|
158
|
+
'role' => Soar::Authentication::IdentityUuidTranslator::Provider::Customer::ROLE
|
159
159
|
},{
|
160
|
-
role
|
160
|
+
'role' => Faker::Company.unique.profession
|
161
161
|
}]
|
162
162
|
end
|
163
163
|
|
@@ -165,10 +165,10 @@ module Soar
|
|
165
165
|
roles.each { |role|
|
166
166
|
entry = {
|
167
167
|
"identity_uuid" => identity_uuid,
|
168
|
-
"identity_role" => role[
|
168
|
+
"identity_role" => role['role']
|
169
169
|
}
|
170
|
-
entry['identity_source'] = role[
|
171
|
-
entry['identity_role_attributes'] = role[
|
170
|
+
entry['identity_source'] = role['source'] if role.key?('source')
|
171
|
+
entry['identity_role_attributes'] = role['attributes'] if role.key?('attributes')
|
172
172
|
roles_directory.put(entry)
|
173
173
|
}
|
174
174
|
end
|
@@ -18,13 +18,13 @@ module Soar
|
|
18
18
|
firstname = Faker::Name.first_name
|
19
19
|
lastname = Faker::Name.last_name
|
20
20
|
@identity = {
|
21
|
-
dn
|
22
|
-
attributes
|
23
|
-
cn
|
24
|
-
givenName
|
25
|
-
mail
|
26
|
-
objectclass
|
27
|
-
sn
|
21
|
+
"dn" => "cn=#{firstname} #{lastname},#{@identity_directory_config['config']['base']}",
|
22
|
+
"attributes" => {
|
23
|
+
"cn" => "#{firstname} #{lastname}",
|
24
|
+
"givenName" => firstname,
|
25
|
+
"mail" => "#{firstname.downcase}.#{lastname.downcase}@hetzner.co.za",
|
26
|
+
"objectclass" => ["inetOrgPerson", "top"],
|
27
|
+
"sn" => lastname
|
28
28
|
}
|
29
29
|
}
|
30
30
|
|
@@ -48,9 +48,9 @@ module Soar
|
|
48
48
|
|
49
49
|
def given_identity
|
50
50
|
wait_for_database do
|
51
|
-
@identity_directory.provider.delete(@identity[
|
51
|
+
@identity_directory.provider.delete(@identity['dn'])
|
52
52
|
@identity_directory.put(@identity)
|
53
|
-
@identity_uuid = @identity_directory.search('mail', @identity[
|
53
|
+
@identity_uuid = @identity_directory.search('mail', @identity['attributes']['mail'])[0]['entryuuid']
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -64,7 +64,7 @@ module Soar
|
|
64
64
|
|
65
65
|
def given_role_with_attributes
|
66
66
|
@roles = generate_roles()
|
67
|
-
@roles[0][
|
67
|
+
@roles[0]['attributes'] = {
|
68
68
|
Faker::Hacker.noun => Faker::Hacker.verb
|
69
69
|
}
|
70
70
|
wait_for_database do
|
@@ -105,7 +105,7 @@ module Soar
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def get_role_attributes
|
108
|
-
@result = @idr.get_attributes(@identity_uuid, @roles.nil? ? Faker::Company.unique.profession : @roles[0][
|
108
|
+
@result = @idr.get_attributes(@identity_uuid, @roles.nil? ? Faker::Company.unique.profession : @roles[0]['role'])
|
109
109
|
end
|
110
110
|
|
111
111
|
##### then
|
@@ -113,20 +113,20 @@ module Soar
|
|
113
113
|
def identity_attributes?
|
114
114
|
roles = {}
|
115
115
|
@roles.each do |entry|
|
116
|
-
roles[entry[
|
116
|
+
roles[entry['role']] = {}
|
117
117
|
end if not @roles.nil?
|
118
118
|
@result == {
|
119
119
|
"identity_uuid" => @identity_uuid,
|
120
|
-
"firstname" => @identity[
|
121
|
-
"lastname" => @identity[
|
122
|
-
"email" => @identity[
|
120
|
+
"firstname" => @identity['attributes']['givenName'],
|
121
|
+
"lastname" => @identity['attributes']['sn'],
|
122
|
+
"email" => @identity['attributes']['mail'],
|
123
123
|
"roles" => roles
|
124
124
|
}
|
125
125
|
end
|
126
126
|
|
127
127
|
def role_with_attributes?
|
128
128
|
role_with_attributes = {
|
129
|
-
@roles[0][
|
129
|
+
@roles[0]['role'] => Hashie.stringify_keys(@roles[0]['attributes'])
|
130
130
|
}
|
131
131
|
@result == role_with_attributes
|
132
132
|
end
|
@@ -137,14 +137,14 @@ module Soar
|
|
137
137
|
|
138
138
|
def role_with_empty_attributes?
|
139
139
|
@result == {
|
140
|
-
@roles[0][
|
140
|
+
@roles[0]['role'] => {}
|
141
141
|
}
|
142
142
|
end
|
143
143
|
|
144
144
|
def roles?
|
145
145
|
|
146
146
|
roles = @roles.map do |entry|
|
147
|
-
entry[
|
147
|
+
entry['role']
|
148
148
|
end
|
149
149
|
@result.sort == roles.sort
|
150
150
|
end
|
@@ -170,25 +170,25 @@ module Soar
|
|
170
170
|
roles.each do |role|
|
171
171
|
entry = {
|
172
172
|
"identity_uuid" => identity_uuid,
|
173
|
-
"identity_role" => role[
|
173
|
+
"identity_role" => role['role']
|
174
174
|
}
|
175
|
-
entry['identity_source'] = role[
|
176
|
-
entry['identity_role_attributes'] = role[
|
175
|
+
entry['identity_source'] = role['source'] if role.key?('source')
|
176
|
+
entry['identity_role_attributes'] = role['attributes'] if role.key?('attributes')
|
177
177
|
roles_directory.put(entry)
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
181
181
|
def generate_roles()
|
182
182
|
roles = [{
|
183
|
-
role
|
183
|
+
'role' => Faker::Company.unique.profession
|
184
184
|
}, {
|
185
|
-
role
|
185
|
+
'role' => Faker::Company.unique.profession
|
186
186
|
}, {
|
187
|
-
role
|
187
|
+
'role' => Faker::Company.unique.profession
|
188
188
|
}, {
|
189
|
-
role
|
189
|
+
'role' => Faker::Company.unique.profession
|
190
190
|
}]
|
191
|
-
roles[0][
|
191
|
+
roles[0]['source'] = "#{Soar::Authentication::IdentityUuidTranslator::Provider::Staff::PREFIX}#{@identity_uuid}"
|
192
192
|
return roles
|
193
193
|
end
|
194
194
|
|
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:
|
4
|
+
version: 6.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-
|
11
|
+
date: 2017-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: soar_idm
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '7.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '7.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: object_selector
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|