soar-registry-identity 3.0.2 → 4.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: de3e83e7e13c2f27225f792a8c48b8e3f7140c8a
4
- data.tar.gz: 82505b8fd08935f0ce95327c678e4f9234b28aaf
3
+ metadata.gz: 5d7b3dcf75590e0d3806f28fa54f2765ff2aab25
4
+ data.tar.gz: 31469380e9669d0e0da94c57de7167e0e9c506f2
5
5
  SHA512:
6
- metadata.gz: 97f093cc47c5a2a1b299707e3f87beaed2319befdd3747d317b34f286c77ecbc9d771f40b52880146f7dca0e3f62147b2e1db2b5d17e19038662f932be046b36
7
- data.tar.gz: 04bd99cd8cb9e9321be6051d5338f0ecb0d8541ac593259667d51f395e53942b7cde2d75c429b0c69ed515c03ebbe0a219e6c2bd836d1392e1c761860a086163
6
+ metadata.gz: 33d2533b2fe38a15db6bccbb3387d8ff06c9e7bb0ce35540553a7de9cd05de933d316cfaa62f647fc18b369cd5831a8b787645ee1314c902c90f8f675fe58b26
7
+ data.tar.gz: c08238ffa602bebe50dc16873a3d30d5eae57a8412718464511127bcabda2b88036979e787c111962829372cb01f30561036a82ea88ed4acc12defd533d5267a
data/README.md CHANGED
@@ -4,64 +4,98 @@
4
4
 
5
5
  ### Example data
6
6
  ```javascript
7
- "identities" = [{
8
- "uuid": "identity-62936e70-1815-439b-bf89-8492855a7e6b",
7
+ identities = [{
8
+ "uuid": "62936e70-1815-439b-bf89-8492855a7e6b",
9
9
  "email": "test+publisher@hetzner.co.za",
10
- "roles": {
11
- "staff": {
12
- "department": "technical"
13
- },
14
- "configuration_publisher": {
15
- "configuration_identifiers": ["*"]
16
- }
17
- }
18
10
  }]
11
+
19
12
  ```
20
13
 
21
14
  ### Directory
22
15
  Create a directory provider
23
16
 
24
17
  ```ruby
25
- require 'soar/registry/directory'
26
- directory_provider = Soar::Registry::Directory::Provider::Stub.new(
27
- table: "identities",
28
- index: ["uuid", "email"]
18
+ > require 'soar/registry/directory'
19
+ > directory_provider = Soar::Registry::Directory::Provider::Stub.new(
20
+ table: "identities",
21
+ index: ["uuid", "email"]
29
22
  )
30
23
  ```
31
24
 
32
25
  Create a directory
33
26
  ```ruby
34
- directory = Soar::Registry::Directory.new(directory_provider)
27
+ > directory = Soar::Registry::Directory.new(directory_provider)
35
28
  ```
36
29
 
37
- ### Staff UUID IDR
38
- Search for roles, attributes or identifiers by UUID. Used by [policies](https://gitlab.host-h.net/policies) to determine authorization.
30
+ ### Instantiation
31
+
32
+ #### Manual instantiation
39
33
 
40
- Create an identity provider.
34
+ ##### Staff Email IDR
35
+ Search for identifiers by email address. Used by [soar-authentication-identity](https://github.com/hetznerZA/soar-authentication-identity) to translate an authenticated identifier to an UUID.
41
36
  ```ruby
42
37
  require 'soar/registry/identity'
43
- identity_provider = Soar::Registry::Identity::Provider::Staff::Id.new(directory: directory)
38
+ identity_provider = Soar::Registry::Identity::Provider::Staff::Email.new({
39
+ directory: directory,
40
+ fetch_index: 'uuid',
41
+ search_index: 'email'
42
+ })
44
43
  ```
45
44
 
46
- Create an IDR
47
45
  ```ruby
48
- @id_idr = Soar::Registry::Identity.new(identity_provider)
46
+ @email_idr = Soar::Registry::Identity.new(identity_provider)
49
47
  ```
50
48
 
51
- ### Staff Email IDR
52
- Search for identifiers by email address. Used by [soar-authentication-identity](https://github.com/hetznerZA/soar-authentication-identity) to translate an authenticated identifier to an UUID.
49
+ #### Factory instantiation
50
+
51
+ ##### Create a selector
53
52
  ```ruby
54
- require 'soar/registry/identity'
55
- identity_provider = Soar::Registry::Identity::Provider::Staff::Email.new(directory: directory)
53
+ > require 'object_selector'
54
+ > selector = ObjectSelector.new(
55
+ ObjectSelector::Provider::RegexRuleList.new({
56
+ rules: [
57
+ {
58
+ regex: /\A[\w+\-.]+@hetzner.co.za\z/i,
59
+ object: Soar::Registry::Identity::Provider::Staff::Email.new({
60
+ directory: Object.new,
61
+ fetch_index: SecureRandom.hex,
62
+ search_index: SecureRandom.hex
63
+ })
64
+ },
65
+ {
66
+ regex: /\A[\w+\-.]+@.+/i,
67
+ object: Soar::Registry::Identity::Provider::Customer::Email.new({
68
+ directory: Object.new,
69
+ fetch_index: SecureRandom.hex,
70
+ search_index: SecureRandom.hex
71
+ })
72
+ },
73
+ {
74
+ regex: /\A[CF]{0,1}\d+\z/,
75
+ object: Soar::Registry::Identity::Provider::Customer::ClientNumber.new({
76
+ directory: Object.new,
77
+ fetch_index: SecureRandom.hex,
78
+ search_index: SecureRandom.hex
79
+ })
80
+ }
81
+ ]
82
+ })
83
+ )
56
84
  ```
57
85
 
86
+ ##### Get an IDR
58
87
  ```ruby
59
- @email_idr = Soar::Registry::Identity.new(identity_provider)
88
+ > selector_value = 'your-string-here'
89
+ idr = Soar::Registry::Identity::Factory.create({
90
+ value: selector_value,
91
+ selector: selector
92
+ })
60
93
  ```
61
94
 
62
- ### Getting a list of identifiers
95
+ ### Use your IDR
96
+
97
+ ##### Getting a list of identifiers
63
98
  ```ruby
64
- > identifiers = @id_idr.get_identifiers("identity-820d5660-2204-4f7d-8c04-746313439b81")
65
99
  > identifiers = @email_idr.get_identifiers("admin@hetzner.co.za")
66
100
  > puts identifiers.inspect
67
101
  ["admin@hetzner.co.za", "identity-820d5660-2204-4f7d-8c04-746313439b81"]
@@ -69,7 +103,8 @@ identity_provider = Soar::Registry::Identity::Provider::Staff::Email.new(directo
69
103
 
70
104
  ### Getting a list of roles
71
105
  ```ruby
72
- > roles = @id_idr.get_roles("identity-820d5660-2204-4f7d-8c04-746313439b81")
106
+ > roles = @uuid_idr.get_roles("identity-820d5660-2204-4f7d-8c04-746313439b81")
107
+ > # get_roles is not applicable to staff email idr
73
108
  > puts roles.inspect
74
109
  ["staff", "configuration_publisher", "configuration_consumer"]
75
110
  ```
@@ -77,7 +112,8 @@ identity_provider = Soar::Registry::Identity::Provider::Staff::Email.new(directo
77
112
  ### Getting a hash of attributes for a role
78
113
  ```ruby
79
114
  > role = 'staff'
80
- > attributes = @id_idr.get_attributes("identity-820d5660-2204-4f7d-8c04-746313439b81", role)
115
+ > attributes = @uuid_idr.get_attributes("identity-820d5660-2204-4f7d-8c04-746313439b81", role)
116
+ > # get_attributes is not applicable to staff email idr
81
117
  > puts attributes.inspect
82
118
  {
83
119
  "staff": {
@@ -89,7 +125,8 @@ identity_provider = Soar::Registry::Identity::Provider::Staff::Email.new(directo
89
125
 
90
126
  ### Getting a hash of all attributes
91
127
  ```ruby
92
- > attributes = @id_idr.get_attributes("identity-820d5660-2204-4f7d-8c04-746313439b81")
128
+ > attributes = @uuid_idr.get_attributes("identity-820d5660-2204-4f7d-8c04-746313439b81")
129
+ > # get_attributes is not applicate to staff email idr
93
130
  > puts attributes.inspect
94
131
  {
95
132
  "identity_id" => "identity-820d5660-2204-4f7d-8c04-746313439b81",
@@ -114,7 +151,6 @@ identity_provider = Soar::Registry::Identity::Provider::Staff::Email.new(directo
114
151
  }
115
152
  ```
116
153
 
117
-
118
154
  ## Tests
119
155
 
120
156
  ### Local
@@ -124,8 +160,9 @@ $ bundle exec rspec
124
160
 
125
161
  ### CI
126
162
  ```bash
127
- docker-compose --file docker-compose.ci.yml up --abort-on-container-exit --remove-orphans --build --force-recreate
128
- EXIT_CODE=$(docker ps -a -f "name=soar-registry-identity-provider-staff" -q | xargs docker inspect -f "{{ .State.ExitCode }}");
163
+ docker-compose --file docker-compose.ci.yml --project-name soar-registry-identity up --abort-on-container-exit --remove-orphans --build --force-recreate
164
+ EXIT_CODE=$(docker ps -a -f "name=soarregistryidentity_tests" -q | xargs docker inspect -f "{{ .State.ExitCode }}");
165
+ docker-compose --file docker-compose.ci.yml --project-name soar-registry-identity down --rmi local
129
166
  exit $EXIT_CODE;
130
167
  ```
131
168
 
@@ -0,0 +1,9 @@
1
+ module Soar
2
+ module Registry
3
+ module Identity
4
+ module Error
5
+ class MissingRequiredDirectoryError < StandardError; end
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ require 'soar/registry/identity'
2
+
3
+ module Soar
4
+ module Registry
5
+ module Identity
6
+ class Factory
7
+
8
+ ##
9
+ # @param [String] value
10
+ # @param [ObjectSelector] selector
11
+ # @raise [ObjectSelector::Error::NoMatchError]
12
+ # @return [Soar::Registry::Identity]
13
+ ##
14
+ def self.create(value: , selector: )
15
+ identity_provider = selector.select(value)
16
+ return Soar::Registry::Identity.new(identity_provider)
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,22 +1,41 @@
1
1
  require 'soar/registry/identity/provider/staff/email'
2
- require 'soar/registry/identity/provider/staff/id'
2
+ require 'soar/registry/identity/provider/staff/uuid'
3
+ require 'soar/registry/identity/provider/customer/client_number'
4
+ require 'soar/registry/identity/provider/customer/email'
3
5
 
4
6
  module Soar
5
7
  module Registry
6
8
  module Identity
7
9
  class Model
10
+
11
+ attr_reader :provider
12
+
8
13
  def initialize(provider)
9
14
  @provider = provider
10
15
  end
11
16
 
17
+ ##
18
+ # @param [String] identifier
19
+ # @return [Array<String>] list of roles
20
+ ##
12
21
  def get_roles(identifier)
13
22
  @provider.get_roles(identifier)
14
23
  end
15
24
 
25
+ ##
26
+ # @param [String] identifier
27
+ # @param [String] role
28
+ # @return [Hash] if a role is specified the returned hash is keyed by role
29
+ # else it's keyed by attribute name
30
+ ##
16
31
  def get_attributes(identifier, role = nil)
17
32
  @provider.get_attributes(identifier, role)
18
33
  end
19
34
 
35
+ ##
36
+ # @param [String] identifier
37
+ # @return [Array<String>] list of identifiers
38
+ ##
20
39
  def get_identifiers(identifier)
21
40
  @provider.get_identifiers(identifier)
22
41
  end
@@ -1,36 +1,28 @@
1
1
  require 'soar_idm/soar_idm'
2
- require 'soar/registry/identity/provider/staff/translator/default'
3
2
 
4
3
  module Soar
5
4
  module Registry
6
5
  module Identity
7
6
  module Provider
8
- module Staff
9
- class Base < SoarIdm::IdmApi
10
-
11
- attr_reader :directory
12
- attr_reader :translator
7
+ module Customer
8
+ class ClientNumber < SoarIdm::IdmApi
13
9
 
14
10
  ##
15
- # @param directory [Hash] directory configuration
11
+ # @param [Soar::Registry::Directory] directory
16
12
  ##
17
- def initialize(directory: nil)
18
- @translator = Soar::Registry::Identity::Provider::Staff::Translator::Default.new
13
+ def initialize(directory:, fetch_index: , search_index: )
19
14
  @directory = directory
15
+ @fetch_index = fetch_index
16
+ @search_index = search_index
20
17
  end
21
18
 
22
19
  ##
23
- # @param [Hash] identity
24
- # @return [Array] list of roles
25
- def calculate_roles(identity)
26
- entry = @directory.fetch(identity[@directory.index[0]])
27
- return nil if not entry
28
- identity = @translator.get_identity(entry)
29
- roles = []
30
- identity['roles'].each do |role, attributes|
31
- roles << role
32
- end
33
- roles
20
+ # @param [String] identifier, an email address that uniquely identifies an identity
21
+ # @return [Hash] an identity
22
+ ##
23
+ def calculate_identities(identity_identifier)
24
+ entries = @directory.search(@search_index, identity_identifier)
25
+ return entries.empty? ? [] : [entries[0]]
34
26
  end
35
27
 
36
28
  ##
@@ -46,25 +38,29 @@ module Soar
46
38
  identifiers
47
39
  end
48
40
 
41
+ ##
42
+ # @param [Hash] identity
43
+ # @return [Array] list of roles
44
+ def calculate_roles(identity)
45
+ raise NotImplementedError
46
+ end
47
+
49
48
  ##
50
49
  # @param [Hash] identity
51
50
  # @param [String] role
52
51
  # @return [Hash] A hash of attributes
53
52
  def calculate_attributes(identity, role)
54
- entry = @directory.fetch(identity[@directory.index[0]])
55
- return nil if not entry
56
- identity = @translator.get_identity(entry)
57
- { role => identity['roles'][role] }
53
+ raise NotImplementedError
58
54
  end
59
55
 
60
56
  ##
61
57
  # @param [Hash] identity
62
58
  # @return [Hash] Hash of attributes keyed by role
63
59
  def calculate_all_attributes(identity)
64
- entry = @directory.fetch(identity[@directory.index[0]])
65
- @translator.get_identity(entry)
60
+ raise NotImplementedError
66
61
  end
67
62
 
63
+
68
64
  end
69
65
  end
70
66
  end
@@ -0,0 +1,69 @@
1
+ require 'soar_idm/soar_idm'
2
+
3
+ module Soar
4
+ module Registry
5
+ module Identity
6
+ module Provider
7
+ module Customer
8
+ class Email < SoarIdm::IdmApi
9
+
10
+ ##
11
+ # @param [Soar::Registry::Directory] directory
12
+ ##
13
+ def initialize(directory:, fetch_index: , search_index: )
14
+ @directory = directory
15
+ @fetch_index = fetch_index
16
+ @search_index = search_index
17
+ end
18
+
19
+ ##
20
+ # @param [String] identifier, an email address that uniquely identifies an identity
21
+ # @return [Hash] an identity
22
+ ##
23
+ def calculate_identities(identity_identifier)
24
+ entries = @directory.search(@search_index, identity_identifier)
25
+ return entries.empty? ? [] : [entries[0]]
26
+ end
27
+
28
+ ##
29
+ # @param [Hash] identity
30
+ # @return [Array] list of identifiers
31
+ ##
32
+ def calculate_identifiers(identity)
33
+ indexes = @directory.index
34
+ identifiers = []
35
+ indexes.each { |index|
36
+ identifiers << identity[index]
37
+ }
38
+ identifiers
39
+ end
40
+
41
+ ##
42
+ # @param [Hash] identity
43
+ # @return [Array] list of roles
44
+ def calculate_roles(identity)
45
+ raise NotImplementedError
46
+ end
47
+
48
+ ##
49
+ # @param [Hash] identity
50
+ # @param [String] role
51
+ # @return [Hash] A hash of attributes
52
+ def calculate_attributes(identity, role)
53
+ raise NotImplementedError
54
+ end
55
+
56
+ ##
57
+ # @param [Hash] identity
58
+ # @return [Hash] Hash of attributes keyed by role
59
+ def calculate_all_attributes(identity)
60
+ raise NotImplementedError
61
+ end
62
+
63
+
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -1,11 +1,15 @@
1
- require 'soar/registry/identity/provider/staff/base'
1
+ require 'soar_idm/soar_idm'
2
2
 
3
3
  module Soar
4
4
  module Registry
5
5
  module Identity
6
6
  module Provider
7
- module Staff
8
- class Id < Base
7
+ module Customer
8
+
9
+ ##
10
+ # Work in progress. Do not use.
11
+ ##
12
+ class Uuid < SoarIdm::IdmApi
9
13
 
10
14
  ##
11
15
  # @param [String] identifier, a primary key that uniquely identifies an identity
@@ -1,21 +1,66 @@
1
- require 'soar/registry/identity/provider/staff/base'
1
+ require 'soar_idm/soar_idm'
2
2
 
3
3
  module Soar
4
4
  module Registry
5
5
  module Identity
6
6
  module Provider
7
7
  module Staff
8
- class Email < Base
8
+ class Email < SoarIdm::IdmApi
9
+
10
+ ##
11
+ # @param [Soar::Registry::Directory] directory
12
+ ##
13
+ def initialize(directory:, fetch_index:, search_index:)
14
+ @directory = directory
15
+ @fetch_index = fetch_index
16
+ @search_index = search_index
17
+ end
9
18
 
10
19
  ##
11
20
  # @param [String] identifier, an email address that uniquely identifies an identity
12
21
  # @return [Hash] an identity
13
22
  ##
14
- def calculate_identities(identifier)
15
- entries = @directory.search(@directory.index[1], identifier )
16
- return entries.empty? ? [] : [@translator.get_identity(entries)[0]]
23
+ def calculate_identities(identity_identifier)
24
+ entries = @directory.search(@search_index, identity_identifier)
25
+ return entries.empty? ? [] : [entries[0]]
26
+ end
27
+
28
+ ##
29
+ # @param [Hash] identity
30
+ # @return [Array] list of identifiers
31
+ ##
32
+ def calculate_identifiers(identity)
33
+ indexes = @directory.index
34
+ identifiers = []
35
+ indexes.each { |index|
36
+ identifiers << identity[index]
37
+ }
38
+ identifiers
17
39
  end
18
40
 
41
+ ##
42
+ # @param [Hash] identity
43
+ # @return [Array] list of roles
44
+ def calculate_roles(identity)
45
+ raise NotImplementedError
46
+ end
47
+
48
+ ##
49
+ # @param [Hash] identity
50
+ # @param [String] role
51
+ # @return [Hash] A hash of attributes
52
+ def calculate_attributes(identity, role)
53
+ raise NotImplementedError
54
+ end
55
+
56
+ ##
57
+ # @param [Hash] identity
58
+ # @return [Hash] Hash of attributes keyed by role
59
+ def calculate_all_attributes(identity)
60
+ raise NotImplementedError
61
+ end
62
+
63
+
19
64
  end
20
65
  end
21
66
  end
@@ -0,0 +1,81 @@
1
+ require 'soar_idm/soar_idm'
2
+
3
+ module Soar
4
+ module Registry
5
+ module Identity
6
+ module Provider
7
+ module Staff
8
+
9
+ ##
10
+ # Work in progress. Do not use.
11
+ ##
12
+ class Uuid < SoarIdm::IdmApi
13
+
14
+ ##
15
+ # @param [Hash] directories
16
+ # @option directories [Object] :identity
17
+ # @option directories [Object] :role
18
+ ##
19
+ def initialize(directories:, fetch_index: "entryuuid")
20
+ raise Soar::Registry::Identity::Error::MissingRequiredDirectoryError, ':identity key is required' if not directories.key?(:identity)
21
+ @identity_directory = directories[:identity]
22
+ @roles_directory = directories.key?(:roles) ? directories[:roles] : directories[:identity]
23
+ end
24
+
25
+ ##
26
+ # @param [Hash] identity
27
+ # @return [Array] list of roles
28
+ def calculate_roles(identity)
29
+ entry = @roles_directory.fetch(identity[@roles_directory.index[0]])
30
+ return nil if not entry
31
+ roles = []
32
+ entry['roles'].each do |role, attributes|
33
+ roles << role
34
+ end
35
+ roles
36
+ end
37
+
38
+ ##
39
+ # @param [Hash] identity
40
+ # @return [Array] list of identifiers
41
+ ##
42
+ def calculate_identifiers(identity)
43
+ indexes = @identity_directory.index
44
+ identifiers = []
45
+ indexes.each { |index|
46
+ identifiers << identity[index]
47
+ }
48
+ identifiers
49
+ end
50
+
51
+ ##
52
+ # @param [Hash] identity
53
+ # @param [String] role
54
+ # @return [Hash] A hash of attributes
55
+ def calculate_attributes(identity, role)
56
+ entry = @roles_directory.fetch(identity[@roles_directory.index[0]])
57
+ return nil if not entry
58
+ { role => entry['roles'][role] }
59
+ end
60
+
61
+ ##
62
+ # @param [Hash] identity
63
+ # @return [Hash] Hash of attributes keyed by role
64
+ def calculate_all_attributes(identity)
65
+ @directory.fetch(identity[@roles_directory.index[0]])
66
+ end
67
+
68
+ ##
69
+ # @param [String] identifier, a primary key that uniquely identifies an identity
70
+ # @return [Hash] an identity
71
+ ##
72
+ def calculate_identities(identifier)
73
+ return [@identity_directory.fetch(identifier)]
74
+ end
75
+
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,18 @@
1
+ [
2
+ {
3
+ "ID": 1,
4
+ "Notifyemail_Invoice": "identity1@example.com",
5
+ "Client_Number": "C123456789"
6
+ },
7
+ {
8
+ "ID": 2,
9
+ "Notifyemail_Invoice": "identity2@example.com",
10
+ "Client_Number": "C135791113"
11
+ },
12
+ {
13
+ "ID": 3,
14
+ "Notifyemail_Invoice": "identity3@example.com",
15
+ "Client_Number": "C2468101214"
16
+ }
17
+ ]
18
+
@@ -0,0 +1,52 @@
1
+ [
2
+ {
3
+ "identity_uuid": "62936e70-1815-439b-bf89-8492855a7e6b",
4
+ "role": "staff",
5
+ "attributes": {
6
+ "department": "technical"
7
+ }
8
+ },
9
+ {
10
+ "identity_uuid": "62936e70-1815-439b-bf89-8492855a7e6b",
11
+ "role": "configuration_publisher",
12
+ "attributes": {
13
+ "configuration_identifiers": ["*"]
14
+ }
15
+ },
16
+ {
17
+ "identity_uuid": "43353f18-8afe-11e6-ae22-56b6b6499611",
18
+ "role": "staff",
19
+ "attributes": {
20
+ "department": "technical"
21
+ }
22
+ },
23
+ {
24
+ "identity_uuid": "43353f18-8afe-11e6-ae22-56b6b6499611",
25
+ "role": "configuration_consumer",
26
+ "attributes": {
27
+ "configuration_identifiers": ["*"]
28
+ }
29
+ },
30
+ {
31
+ "identity_uuid": "820d5660-2204-4f7d-8c04-746313439b81",
32
+ "role": "staff",
33
+ "attributes": {
34
+ "department": "technical"
35
+ }
36
+ },
37
+ {
38
+ "identity_uuid": "820d5660-2204-4f7d-8c04-746313439b81",
39
+ "role": "configuration_publisher",
40
+ "attributes": {
41
+ "configuration_identifiers": ["*"]
42
+ }
43
+ },
44
+ {
45
+ "identity_uuid": "820d5660-2204-4f7d-8c04-746313439b81",
46
+ "role": "configuration_consumer",
47
+ "attributes": {
48
+ "configuration_identifiers": ["*"]
49
+ }
50
+ }
51
+ ]
52
+
@@ -0,0 +1,19 @@
1
+ [
2
+ {
3
+ "entryuuid": "62936e70-1815-439b-bf89-8492855a7e6b",
4
+ "mail": "test+publisher@hetzner.co.za"
5
+ },
6
+ {
7
+ "entryuuid": "43353f18-8afe-11e6-ae22-56b6b6499611",
8
+ "mail": "test+consumer@hetzner.co.za"
9
+ },
10
+ {
11
+ "entryuuid": "820d5660-2204-4f7d-8c04-746313439b81",
12
+ "mail": "admin@hetzner.co.za"
13
+ },
14
+ {
15
+ "entryuuid": "1ff472a6-8df3-4f13-82c3-89fde26db3cf",
16
+ "mail": "none@example.com"
17
+ }
18
+ ]
19
+
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: 3.0.2
4
+ version: 4.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-01-25 00:00:00.000000000 Z
11
+ date: 2017-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: soar_idm
@@ -30,20 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '4.0'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 4.0.5
33
+ version: '5.0'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '4.0'
44
- - - ">="
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: object_selector
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
45
53
  - !ruby/object:Gem::Version
46
- version: 4.0.5
54
+ version: '1.0'
47
55
  description: Registry of identities
48
56
  email: charles.mulder@hetzner.co.za
49
57
  executables: []
@@ -52,13 +60,17 @@ extra_rdoc_files: []
52
60
  files:
53
61
  - README.md
54
62
  - lib/soar/registry/identity.rb
63
+ - lib/soar/registry/identity/error.rb
64
+ - lib/soar/registry/identity/factory.rb
55
65
  - lib/soar/registry/identity/model.rb
56
- - lib/soar/registry/identity/provider/staff/base.rb
66
+ - lib/soar/registry/identity/provider/customer/client_number.rb
67
+ - lib/soar/registry/identity/provider/customer/email.rb
68
+ - lib/soar/registry/identity/provider/customer/uuid.rb
57
69
  - lib/soar/registry/identity/provider/staff/email.rb
58
- - lib/soar/registry/identity/provider/staff/id.rb
59
- - lib/soar/registry/identity/provider/staff/translator/default.rb
60
- - lib/soar/registry/identity/test/fixtures/dynamodb.json
61
- - lib/soar/registry/identity/test/fixtures/ldap.json
70
+ - lib/soar/registry/identity/provider/staff/uuid.rb
71
+ - lib/soar/registry/identity/test/fixtures/customer/identities.json
72
+ - lib/soar/registry/identity/test/fixtures/roles.json
73
+ - lib/soar/registry/identity/test/fixtures/staff/identities.json
62
74
  homepage: https://gitlab.host-h.net/registries/identity
63
75
  licenses:
64
76
  - MIT
@@ -1,31 +0,0 @@
1
- module Soar
2
- module Registry
3
- module Identity
4
- module Provider
5
- module Staff
6
- module Translator
7
- class Default
8
-
9
- ##
10
- # @param [Hash] entry a single entry from datasource
11
- # @returns [Hash] identity a single identity
12
- ##
13
- def get_identity(entry)
14
- return entry
15
- end
16
-
17
- ##
18
- # @param [Array] entries a list of entries from data source
19
- # @return [Array] identities a list of identities
20
- ##
21
- def get_identities(entries)
22
- return entries
23
- end
24
-
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,44 +0,0 @@
1
- [
2
- {
3
- "uuid": "identity-62936e70-1815-439b-bf89-8492855a7e6b",
4
- "roles": {
5
- "staff": {
6
- "department": "technical"
7
- },
8
- "configuration_publisher": {
9
- "configuration_identifiers": ["*"]
10
- }
11
- }
12
- },
13
- {
14
- "uuid": "identity-43353f18-8afe-11e6-ae22-56b6b6499611",
15
- "roles": {
16
- "staff": {},
17
- "configuration_consumer": {
18
- "configuration_identifiers": ["*"]
19
- }
20
-
21
- }
22
- },
23
- {
24
- "uuid": "identity-820d5660-2204-4f7d-8c04-746313439b81",
25
- "roles": {
26
- "staff": {},
27
- "configuration_publisher": {
28
- "configuration_identifiers": ["*"]
29
- },
30
- "configuration_consumer": {
31
- "configuration_identifiers": ["*"]
32
- }
33
-
34
- }
35
- },
36
- {
37
- "uuid": "identity-1ff472a6-8df3-4f13-82c3-89fde26db3cf",
38
- "roles": {
39
- "customer": {},
40
- "reseller": {}
41
- }
42
- }
43
- ]
44
-
@@ -1,19 +0,0 @@
1
- [
2
- {
3
- "entryuuid": "identity-62936e70-1815-439b-bf89-8492855a7e6b",
4
- "mail": "test+publisher@hetzner.co.za"
5
- },
6
- {
7
- "entryuuid": "identity-43353f18-8afe-11e6-ae22-56b6b6499611",
8
- "mail": "test+consumer@hetzner.co.za"
9
- },
10
- {
11
- "entryuuid": "identity-820d5660-2204-4f7d-8c04-746313439b81",
12
- "mail": "admin@hetzner.co.za"
13
- },
14
- {
15
- "entryuuid": "identity-1ff472a6-8df3-4f13-82c3-89fde26db3cf",
16
- "mail": "none@example.com"
17
- }
18
- ]
19
-