checken 0.0.3 → 0.0.4
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/checken/dsl/group_dsl.rb +2 -0
- data/lib/checken/permission.rb +14 -0
- data/lib/checken/permission_group.rb +15 -0
- data/lib/checken/schema.rb +16 -0
- data/lib/checken/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26f7fc494eacd3729c46774a936ba735a317c2835f7df07abf3920afe3cbf792
|
4
|
+
data.tar.gz: 5d449e1b99a7fe53e366796c13ad73d09ca332115b770ab6dbac0e04ba709ead
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83c122e8c10a61bfab0a0da4709cc7fbe9241514398b7d1e90a88b8ceecf24a8be0864dd29de0e819f799a5ae3b23544ac18bcbcf493bee04eb69a210d7c5b71
|
7
|
+
data.tar.gz: fbea10f7112b0e37480e50a33480a93c5dc91732735c1c1f477009b87b45c00ec1b7ba173462f6ac14b068cb7e1bf0621a5dd975faf186dc81e3d77ce906a06b
|
@@ -36,6 +36,7 @@ module Checken
|
|
36
36
|
def group(key, &block)
|
37
37
|
sub_group = @group.groups[key.to_sym] || @group.add_group(key.to_sym)
|
38
38
|
sub_group.dsl(:active_sets => active_sets, &block) if block_given?
|
39
|
+
sub_group.update_schema
|
39
40
|
sub_group
|
40
41
|
end
|
41
42
|
|
@@ -66,6 +67,7 @@ module Checken
|
|
66
67
|
end
|
67
68
|
|
68
69
|
permission.dsl(&block) if block_given?
|
70
|
+
permission.update_schema
|
69
71
|
permission
|
70
72
|
end
|
71
73
|
|
data/lib/checken/permission.rb
CHANGED
@@ -295,5 +295,19 @@ module Checken
|
|
295
295
|
end.flatten
|
296
296
|
end
|
297
297
|
|
298
|
+
def update_schema
|
299
|
+
return if path.nil?
|
300
|
+
|
301
|
+
group.schema.update_schema(
|
302
|
+
{
|
303
|
+
path => {
|
304
|
+
type: :permission,
|
305
|
+
description: description,
|
306
|
+
group: group.path
|
307
|
+
}
|
308
|
+
}
|
309
|
+
)
|
310
|
+
end
|
311
|
+
|
298
312
|
end
|
299
313
|
end
|
@@ -165,5 +165,20 @@ module Checken
|
|
165
165
|
dsl
|
166
166
|
end
|
167
167
|
|
168
|
+
def update_schema
|
169
|
+
return if path.nil?
|
170
|
+
|
171
|
+
schema.update_schema(
|
172
|
+
{
|
173
|
+
path => {
|
174
|
+
type: :group,
|
175
|
+
name: name,
|
176
|
+
description: description,
|
177
|
+
group: group&.path
|
178
|
+
}
|
179
|
+
}
|
180
|
+
)
|
181
|
+
end
|
182
|
+
|
168
183
|
end
|
169
184
|
end
|
data/lib/checken/schema.rb
CHANGED
@@ -19,6 +19,7 @@ module Checken
|
|
19
19
|
def initialize
|
20
20
|
@root_group = PermissionGroup.new(self, nil)
|
21
21
|
@config = Config.new
|
22
|
+
@schema = {}
|
22
23
|
end
|
23
24
|
|
24
25
|
# Add configuration for this schema
|
@@ -128,5 +129,20 @@ module Checken
|
|
128
129
|
@config.logger
|
129
130
|
end
|
130
131
|
|
132
|
+
# Update the schema with the given entry
|
133
|
+
#
|
134
|
+
# @param entry [Hash]
|
135
|
+
# @return [Hash]
|
136
|
+
def update_schema(entry)
|
137
|
+
@schema.merge!(entry)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Return the schema sorted alphabetically by key
|
141
|
+
#
|
142
|
+
# @return [Hash]
|
143
|
+
def schema
|
144
|
+
@schema.sort.to_h
|
145
|
+
end
|
146
|
+
|
131
147
|
end
|
132
148
|
end
|
data/lib/checken/version.rb
CHANGED