iknow_view_models 3.6.3 → 3.6.4
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31ecbd493e6716db0442e309c1566f38c13f676ef72a55ea9708f1537875331f
|
4
|
+
data.tar.gz: b03d5b1b1f0d3ba458f11f5575f379969eea72089f781ef65462ab47e181e158
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06e8384611d8fe7e93ac6065c11aca651f15b717be02a0818106198b769fe6ea59c843a83fd7cd457089a44a98cda499e7f5a2ae905d6c4b46c04e18c68cd4af
|
7
|
+
data.tar.gz: 3c20e972b8a5011aeae40494bf8d271ec3ef5092bbccb7495ea435a7e99dbf45b89f632e868c56bdf681722251f4432e6bd426dba2bfd9d2ef93cce7fc71c066
|
@@ -175,11 +175,10 @@ class ViewModel::AccessControl::Composed < ViewModel::AccessControl
|
|
175
175
|
end
|
176
176
|
|
177
177
|
def inspect
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
s
|
178
|
+
checks = inspect_checks
|
179
|
+
checks << "includes checkers: #{@included_checkers.inspect}" if @included_checkers.present?
|
180
|
+
|
181
|
+
super + '(' + checks.join(', ') + ')'
|
183
182
|
end
|
184
183
|
|
185
184
|
def inspect_checks
|
@@ -192,8 +192,6 @@ class ViewModel::AccessControl::Tree < ViewModel::AccessControl
|
|
192
192
|
def inspect_checks
|
193
193
|
checks = super
|
194
194
|
if root?
|
195
|
-
checks << 'no root checks'
|
196
|
-
else
|
197
195
|
checks << "root_children_visible_if: #{root_children_visible_ifs.map(&:reason)}" if root_children_visible_ifs.present?
|
198
196
|
checks << "root_children_visible_unless: #{root_children_visible_unlesses.map(&:reason)}" if root_children_visible_unlesses.present?
|
199
197
|
checks << "root_children_editable_if: #{root_children_editable_ifs.map(&:reason)}" if root_children_editable_ifs.present?
|
@@ -252,16 +250,16 @@ class ViewModel::AccessControl::Tree < ViewModel::AccessControl
|
|
252
250
|
|
253
251
|
def save_root_visibility!(traversal_env)
|
254
252
|
result = check_delegates(traversal_env,
|
255
|
-
self.class.each_check(:root_children_visible_ifs, ->(a) { a
|
256
|
-
self.class.each_check(:root_children_visible_unlesses, ->(a) { a
|
253
|
+
self.class.each_check(:root_children_visible_ifs, ->(a) { a < Node }),
|
254
|
+
self.class.each_check(:root_children_visible_unlesses, ->(a) { a < Node }))
|
257
255
|
|
258
256
|
store_descendent_visibility(traversal_env.view, result)
|
259
257
|
end
|
260
258
|
|
261
259
|
def save_root_editability!(traversal_env)
|
262
260
|
result = check_delegates(traversal_env,
|
263
|
-
self.class.each_check(:root_children_editable_ifs, ->(a) { a
|
264
|
-
self.class.each_check(:root_children_editable_unlesses, ->(a) { a
|
261
|
+
self.class.each_check(:root_children_editable_ifs, ->(a) { a < Node }),
|
262
|
+
self.class.each_check(:root_children_editable_unlesses, ->(a) { a < Node }))
|
265
263
|
|
266
264
|
store_descendent_editability(traversal_env.view, result)
|
267
265
|
end
|
@@ -319,6 +319,26 @@ class ViewModel::AccessControlTest < ActiveSupport::TestCase
|
|
319
319
|
assert_serializes(Tree1View, make_tree('rule:visible_children', 'visible child', 'rule:visible_children', 'visible child'))
|
320
320
|
end
|
321
321
|
|
322
|
+
def test_root_inheritance
|
323
|
+
parent_access_control = Class.new(ViewModel::AccessControl::Tree)
|
324
|
+
parent_access_control.view 'Tree1' do
|
325
|
+
visible_if!('true') { true }
|
326
|
+
|
327
|
+
root_children_visible_if!('root children visible') do
|
328
|
+
view.val == 'rule:visible_children'
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
TestAccessControl.include_from(parent_access_control)
|
333
|
+
|
334
|
+
refute_serializes(Tree1View, make_tree('arbitrary parent', 'invisible child'))
|
335
|
+
assert_serializes(Tree1View, make_tree('rule:visible_children', 'visible child'))
|
336
|
+
|
337
|
+
# nested root
|
338
|
+
refute_serializes(Tree1View, make_tree('rule:visible_children', 'visible child', 'arbitrary parent', 'invisible child'))
|
339
|
+
assert_serializes(Tree1View, make_tree('rule:visible_children', 'visible child', 'rule:visible_children', 'visible child'))
|
340
|
+
end
|
341
|
+
|
322
342
|
def test_visibility_veto_from_root
|
323
343
|
TestAccessControl.view 'Tree1' do
|
324
344
|
root_children_visible_unless!('root children invisible') do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iknow_view_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iKnow Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|