cancancan-neo4j 1.2.1 → 1.2.2
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: f5213aae2b6c9b1dced0d36464e2ae1c458f9fc9
|
4
|
+
data.tar.gz: dcddcb66fef4186dc1a8ac08c4e11619982d645a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '008f34d8928100cb0d40cd291f30567238007cdf3a3358766d6f2990244caf6bb76e9296ac35a5989f0a09830923c94e67d5dfb6e9f3a4e0e304cb4dcfb9c725'
|
7
|
+
data.tar.gz: 1a7a2ceff81a4038556862cff6281a05987286732395c4792701b53c23b2c8fb0452aa185d7d2635a8ee5d0b326077b773897108763dbccf61e6d0dc76a41571
|
@@ -41,9 +41,8 @@ module CanCanCan
|
|
41
41
|
model_attr_exists = model_conditions.any? do |key, _|
|
42
42
|
!target_class.associations_keys.include?(key)
|
43
43
|
end
|
44
|
-
|
45
|
-
|
46
|
-
current_path = @options[:path] + arrow_cypher + end_node
|
44
|
+
to_node = CypherConstructorHelper.match_node_cypher(target_class) if model_attr_exists
|
45
|
+
current_path = path_with_relationship(relationship, rel_length, to_node)
|
47
46
|
if model_attr_exists
|
48
47
|
append_matches(relationship)
|
49
48
|
append_and_to_conditions_string
|
@@ -68,9 +67,10 @@ module CanCanCan
|
|
68
67
|
@conditions_string += con_string
|
69
68
|
end
|
70
69
|
|
71
|
-
def path_with_relationship(relationship, rel_length)
|
70
|
+
def path_with_relationship(relationship, rel_length, to_node = nil)
|
72
71
|
arrow_cypher = relationship.arrow_cypher(nil, {}, false, false, rel_length)
|
73
|
-
|
72
|
+
to_node_label = CypherConstructorHelper.path_end_node(relationship)
|
73
|
+
@options[:path] + arrow_cypher + (to_node || to_node_label)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -35,7 +35,8 @@ module CanCanCan
|
|
35
35
|
|
36
36
|
def condtion_for_path(path:, variable_name:, base_class:, key:)
|
37
37
|
path = "(#{variable_name})" if path.blank?
|
38
|
-
|
38
|
+
relationship = base_class.associations[key]
|
39
|
+
path + relationship.arrow_cypher + path_end_node(relationship)
|
39
40
|
end
|
40
41
|
|
41
42
|
def condition_for_id(base_class, variable_name, value)
|
@@ -65,6 +66,10 @@ module CanCanCan
|
|
65
66
|
connector += 'NOT' if rule_cypher.append_not_to_conditions?
|
66
67
|
cypher_options[:conditions] = conditions_string + connector
|
67
68
|
end
|
69
|
+
|
70
|
+
def path_end_node(relationship)
|
71
|
+
'(' + relationship.target_class.mapped_label_names.map { |label_name| ":`#{label_name}`" }.join + ')'
|
72
|
+
end
|
68
73
|
end
|
69
74
|
end
|
70
75
|
end
|
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.2.
|
4
|
+
version: 1.2.2
|
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-
|
11
|
+
date: 2018-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|