soar-idr-configuration_service_manager 0.0.1
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 +7 -0
- data/lib/soar/idr/configuration_service_manager.rb +79 -0
- metadata +58 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4c51331f5140f25df67de85a3d13ba3312781a7f
|
4
|
+
data.tar.gz: e29222fcef203f8f79968c1e3e7423ebabc04324
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 079efaf53b8a7bc9c591f6cd1f63463ff2535ba54618e8dd8f7f43710685b62556f51cad41c0179af58dda8eab7d229c36e48a9dd3e80ae8c3c053ed5b19ea23
|
7
|
+
data.tar.gz: efe1a381a91c0f6de94dfa7fa08c624513500397b8bdb4e29bbf745f1fa2d01f22bf6d9d3f00c47ac9ec218d3d157c258eb0f10a64281a93380c6a91aa5d60b3
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'soar_idm/soar_idm'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Soar
|
5
|
+
module Idr
|
6
|
+
class ConfigurationServiceManager < SoarIdm::IdmApi
|
7
|
+
|
8
|
+
@@attributes = {
|
9
|
+
"configuration_consumer" => {
|
10
|
+
"configuration_identifiers" => ['*']
|
11
|
+
},
|
12
|
+
"configuration_publisher" => {
|
13
|
+
"configuration_identifiers" => ['*']
|
14
|
+
},
|
15
|
+
"none" => {}
|
16
|
+
}
|
17
|
+
|
18
|
+
@@roles = ['configuration_publisher', 'configuration_consumer']
|
19
|
+
|
20
|
+
def self.roles
|
21
|
+
@@roles
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.attributes
|
25
|
+
@@attributes
|
26
|
+
end
|
27
|
+
|
28
|
+
def calculate_roles(identity)
|
29
|
+
if hetzner_email?(identity)
|
30
|
+
return [@@roles[0]] if publisher?(identity)
|
31
|
+
return [@@roles[1]] if consumer?(identity)
|
32
|
+
return [@@roles[0], @@roles[1]]
|
33
|
+
end
|
34
|
+
[]
|
35
|
+
end
|
36
|
+
|
37
|
+
def calculate_attributes(identity, role)
|
38
|
+
return @@attributes[role]
|
39
|
+
#return {
|
40
|
+
# role => @@attributes[role]
|
41
|
+
#}
|
42
|
+
end
|
43
|
+
|
44
|
+
def calculate_all_attributes(identity)
|
45
|
+
attributes = {}
|
46
|
+
roles = calculate_roles(identity)
|
47
|
+
roles.each do |role|
|
48
|
+
attributes[role] = calculate_attributes(identity, role)
|
49
|
+
end
|
50
|
+
attributes
|
51
|
+
end
|
52
|
+
|
53
|
+
def calculate_identities(entity_identifier)
|
54
|
+
[entity_identifier]
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def hetzner_email?(identity)
|
60
|
+
identity.end_with?('@hetzner.co.za')
|
61
|
+
end
|
62
|
+
|
63
|
+
def publisher?(identity)
|
64
|
+
local = get_local(identity)
|
65
|
+
/\+publisher\z/.match(local)
|
66
|
+
end
|
67
|
+
|
68
|
+
def consumer?(identity)
|
69
|
+
local = get_local(identity)
|
70
|
+
/\+consumer\z/.match(local)
|
71
|
+
end
|
72
|
+
|
73
|
+
def get_local(email)
|
74
|
+
email.split('@')[0]
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: soar-idr-configuration_service_manager
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Charles Mulder
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: soar_idm
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.2
|
27
|
+
description: Identity Registry for Configuration Service Manager
|
28
|
+
email: charles.mulder@hetzner.co.za
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/soar/idr/configuration_service_manager.rb
|
34
|
+
homepage: https://gitlab.host-h.net/identity-registries/configuration_service_manager
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
|
+
metadata: {}
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 2.5.1
|
55
|
+
signing_key:
|
56
|
+
specification_version: 4
|
57
|
+
summary: Identity Registry for Configuration Service Manager
|
58
|
+
test_files: []
|