cancancan-neo4j 1.0.3 → 1.2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3b85a803fa71306a5981e5c4088db18f510fe9f
|
4
|
+
data.tar.gz: 6fc3de2b840ebd7bb26e979aed7956d1499231ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4afcef739b4b5f44864656692d6da844b0bac734534e7ac18d8cc1355e9ccd00776d7d6292888eb9db5bebab46c59df0bd5a16ffaddfb39925886b2b7109230c
|
7
|
+
data.tar.gz: f3dd00a1d6fbbd64aeb9e249b73cd4a3e047f6c355c6d94b9807133dcaa4fa5ca91f5011faaeca4c85b00f9ac6cb958f53ac2c127ead78c047fb03fa66deeeb2
|
@@ -65,7 +65,8 @@ module CanCan
|
|
65
65
|
def self.associations_conditions_match?(conditions, subject, base_class)
|
66
66
|
return true if conditions.blank?
|
67
67
|
conditions.all? do |association, conditions_hash|
|
68
|
-
|
68
|
+
rel_length = conditions_hash.delete(:rel_length)
|
69
|
+
current_subject = subject.send(association, rel_length: rel_length)
|
69
70
|
return false unless current_subject
|
70
71
|
current_model = base_class.associations[association].target_class
|
71
72
|
all_conditions_match?(current_subject, conditions_hash, current_model)
|
@@ -17,7 +17,8 @@ module CanCanCan
|
|
17
17
|
@options[:asso_conditions].each do |association, conditions|
|
18
18
|
relationship = association_relation(association)
|
19
19
|
associations_conditions, model_conditions = CypherConstructorHelper.bifurcate_conditions(conditions)
|
20
|
-
|
20
|
+
rel_length = associations_conditions.delete(:rel_length)
|
21
|
+
current_path = append_path_to_conditions(relationship, model_conditions, rel_length)
|
21
22
|
append_model_conditions(model_conditions, relationship, current_path)
|
22
23
|
append_association_conditions(associations_conditions, relationship)
|
23
24
|
end
|
@@ -35,13 +36,14 @@ module CanCanCan
|
|
35
36
|
@cypher_matches += asso_conditions_obj.cypher_matches
|
36
37
|
end
|
37
38
|
|
38
|
-
def append_path_to_conditions(relationship, model_conditions)
|
39
|
+
def append_path_to_conditions(relationship, model_conditions, rel_length)
|
39
40
|
target_class = relationship.target_class
|
40
41
|
model_attr_exists = model_conditions.any? do |key, _|
|
41
42
|
!target_class.associations_keys.include?(key)
|
42
43
|
end
|
43
44
|
end_node = model_attr_exists ? CypherConstructorHelper.match_node_cypher(target_class) : '()'
|
44
|
-
|
45
|
+
arrow_cypher = relationship.arrow_cypher(nil, {}, false, false, rel_length)
|
46
|
+
current_path = @options[:path] + arrow_cypher + end_node
|
45
47
|
if model_attr_exists
|
46
48
|
append_matches(relationship)
|
47
49
|
append_and_to_conditions_string
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cancancan-neo4j
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amit Suryavanshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|