soar-registry-staff 0.0.1 → 0.0.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f544b6dad6e1d457e519a2224be548670b5246ac
|
4
|
+
data.tar.gz: c2d23d9e7ca7d1054494eaa8a1f7592cad6fe4e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07dc861ee7813b76348ec62e22303bed71f0e3b6b4cd6bdf9662f2b333b61eb9dd72645c656a2325d4353dc9d333d0c652307e47d9bd6811d1ed0bbda8aa0fd2
|
7
|
+
data.tar.gz: 5e5845c4717996db03667913cab21840ceabde5dc338b906eacaf78784b56faa19a35de10307dbb77aaa08563ecd4932d4ebcdfc0ad5a70640d420b5b5f06e04
|
@@ -65,7 +65,11 @@ module Soar
|
|
65
65
|
|
66
66
|
def ready?
|
67
67
|
begin
|
68
|
-
return @client.list_tables.table_names.class.name == 'Array'
|
68
|
+
#return @client.list_tables.table_names.class.name == 'Array'
|
69
|
+
resp = @client.describe_table({
|
70
|
+
table_name: @table_name
|
71
|
+
})
|
72
|
+
return resp.table.table_name == @table_name
|
69
73
|
rescue Seahorse::Client::NetworkingError
|
70
74
|
return false
|
71
75
|
end
|
@@ -30,8 +30,8 @@ module Soar
|
|
30
30
|
##
|
31
31
|
# @param [String] identity_id
|
32
32
|
# @return [Array] list of roles
|
33
|
-
def calculate_roles(
|
34
|
-
entry = @directory.fetch_identity(identity_id)
|
33
|
+
def calculate_roles(identity)
|
34
|
+
entry = @directory.fetch_identity(identity['identity_id'])
|
35
35
|
return nil if not entry
|
36
36
|
identity = @translator.get_identity(entry)
|
37
37
|
roles = []
|
@@ -45,9 +45,9 @@ module Soar
|
|
45
45
|
# @param [String] identity_id
|
46
46
|
# @return [Array] list of identifiers
|
47
47
|
##
|
48
|
-
def calculate_identifiers(
|
48
|
+
def calculate_identifiers(identity)
|
49
49
|
indexes = @directory.indexed_attributes
|
50
|
-
entry = @directory.fetch_identity(identity_id)
|
50
|
+
entry = @directory.fetch_identity(identity['identity_id'])
|
51
51
|
identity = @translator.get_identity(entry)
|
52
52
|
identifiers = []
|
53
53
|
indexes.each { |index|
|
@@ -60,8 +60,8 @@ module Soar
|
|
60
60
|
# @param [String] identity_id
|
61
61
|
# @param [String] role
|
62
62
|
# @return [Hash] A hash of attributes
|
63
|
-
def calculate_attributes(
|
64
|
-
entry = @directory.fetch_identity(identity_id)
|
63
|
+
def calculate_attributes(identity, role)
|
64
|
+
entry = @directory.fetch_identity(identity['identity_id'])
|
65
65
|
return nil if not entry
|
66
66
|
identity = @translator.get_identity(entry)
|
67
67
|
{ role => identity['roles'][role] }
|
@@ -70,18 +70,21 @@ module Soar
|
|
70
70
|
##
|
71
71
|
# @param [String] identity_id
|
72
72
|
# @return [Hash] Hash of attributes keyed by role
|
73
|
-
def calculate_all_attributes(
|
74
|
-
entry = @directory.fetch_identity(identity_id)
|
73
|
+
def calculate_all_attributes(identity)
|
74
|
+
entry = @directory.fetch_identity(identity['identity_id'])
|
75
75
|
@translator.get_identity(entry)
|
76
76
|
end
|
77
77
|
|
78
78
|
##
|
79
|
-
# @param [Hash] identifier containing attribute name and attribute value
|
79
|
+
# @param [String|Hash] identity_id or identifier (a hash containing attribute name and attribute value)
|
80
80
|
# @return [Array]
|
81
81
|
def calculate_identities(identifier)
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
if @translator.is_json?(identifier)
|
83
|
+
identifier = @translator.get_identifier(identifier)
|
84
|
+
entries = @directory.search_identities(identifier.keys[0], identifier[identifier.keys[0]] )
|
85
|
+
return [@translator.get_identity(entries)[0]]
|
86
|
+
end
|
87
|
+
return [@translator.get_identity(@directory.fetch_identity(identifier))]
|
85
88
|
end
|
86
89
|
|
87
90
|
end
|
@@ -12,6 +12,15 @@ module Soar
|
|
12
12
|
return entry
|
13
13
|
end
|
14
14
|
|
15
|
+
def is_json?(json)
|
16
|
+
begin
|
17
|
+
JSON.parse(json)
|
18
|
+
return true
|
19
|
+
rescue JSON::ParserError => e
|
20
|
+
return false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
15
24
|
##
|
16
25
|
# @param [Array] entries a list of entries from data source
|
17
26
|
# @return [Array] identities a list of identities
|