forest_admin_datasource_toolkit 1.39.1 → 1.39.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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af709d0c39e625f9f1a83754e7934f1a9b8cecbe58b984ff2d7f4158a74ef43a
|
|
4
|
+
data.tar.gz: 7501bec570294a030a5714099a28061090313faee2597ca978fed9d975007dd3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b3a10a88b66528f98d98492bfb6fc0f32a8c73fd686658064f9d468638c65b6efc24f8a67a049dd9b397d9ed3359295f7727b66352dfc0b1f3a4cbad7f0e1f8f
|
|
7
|
+
data.tar.gz: 6e30813f7804fcfa01f24db16a4e88be5af61716ac1e3030acc0222809e42a3fde8c97e0cb8cfadb2c9524b51ede3cf314c7ae8464a821e0d280569ae9b30ab6
|
|
@@ -77,6 +77,14 @@ module ForestAdminDatasourceToolkit
|
|
|
77
77
|
@child_collection.render_chart(caller, name, record_id, parameters)
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
+
# Which fields a search will actually reach, and the collection each one ends on. +nil+ means
|
|
81
|
+
# the collection cannot say, which a caller must read as "unknown", never as "none".
|
|
82
|
+
def searched_fields(search, extended)
|
|
83
|
+
return nil unless @child_collection.is_a?(CollectionDecorator)
|
|
84
|
+
|
|
85
|
+
@child_collection.searched_fields(search, extended)
|
|
86
|
+
end
|
|
87
|
+
|
|
80
88
|
protected
|
|
81
89
|
|
|
82
90
|
def mark_schema_as_dirty
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module ForestAdminDatasourceToolkit
|
|
2
|
+
module Utils
|
|
3
|
+
class FieldPath
|
|
4
|
+
POLYMORPHIC_MANY_TO_ONE = 'PolymorphicManyToOne'.freeze
|
|
5
|
+
|
|
6
|
+
# The collections whose column a path ends on — the ones a read permission applies to.
|
|
7
|
+
# Collections crossed on the way are joins, not read targets, so they are not returned.
|
|
8
|
+
#
|
|
9
|
+
# Several names come back for a path ending on a polymorphic relation: it carries no
|
|
10
|
+
# discriminant, so any record may resolve to any of its targets and none can be ruled out. The
|
|
11
|
+
# list is empty for a polymorphic relation declaring no target at all, which the caller counts
|
|
12
|
+
# as denied — an empty list is a path that resolves to nothing, not a path that needs nothing.
|
|
13
|
+
#
|
|
14
|
+
# A prefix naming no relation raises rather than falling back to +collection+. The caller pins
|
|
15
|
+
# the collection it asked about to readable, so falling back would turn "this path does not
|
|
16
|
+
# resolve" into "this path is allowed".
|
|
17
|
+
#
|
|
18
|
+
# A path with no prefix at all is a column of +collection+ itself, and so is allowed. Two
|
|
19
|
+
# customisations reach a related collection through one deliberately: +import_field+, and an
|
|
20
|
+
# +add_field+ whose dependencies cross a relation, both register a root-level column that the
|
|
21
|
+
# operator and sorting layers rewrite into a relation path below this guard. Like a scope or a
|
|
22
|
+
# +replace_search+, they are the customer's own choice of what a role reaches through a column
|
|
23
|
+
# it can read.
|
|
24
|
+
def self.leaf_collection_names(collection, path)
|
|
25
|
+
index = path.index(':')
|
|
26
|
+
|
|
27
|
+
return [collection.name] if index.nil?
|
|
28
|
+
|
|
29
|
+
relation = relation_at(collection, path[0...index])
|
|
30
|
+
|
|
31
|
+
return relation.foreign_collections if relation.type == POLYMORPHIC_MANY_TO_ONE
|
|
32
|
+
|
|
33
|
+
leaf_collection_names(
|
|
34
|
+
collection.datasource.get_collection(relation.foreign_collection),
|
|
35
|
+
path[(index + 1)..]
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.relation_at(collection, name)
|
|
40
|
+
field = collection.schema[:fields][name]
|
|
41
|
+
|
|
42
|
+
if field.nil? || field.type == 'Column'
|
|
43
|
+
raise Exceptions::ForestException, "Relation not found: '#{collection.name}.#{name}'"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
field
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private_class_method :relation_at
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_admin_datasource_toolkit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.39.
|
|
4
|
+
version: 1.39.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthieu
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-08-
|
|
12
|
+
date: 2026-08-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
@@ -217,6 +217,7 @@ files:
|
|
|
217
217
|
- lib/forest_admin_datasource_toolkit/schema/relations/polymorphic_one_to_many_schema.rb
|
|
218
218
|
- lib/forest_admin_datasource_toolkit/schema/relations/polymorphic_one_to_one_schema.rb
|
|
219
219
|
- lib/forest_admin_datasource_toolkit/utils/collection.rb
|
|
220
|
+
- lib/forest_admin_datasource_toolkit/utils/field_path.rb
|
|
220
221
|
- lib/forest_admin_datasource_toolkit/utils/hash_helper.rb
|
|
221
222
|
- lib/forest_admin_datasource_toolkit/utils/record.rb
|
|
222
223
|
- lib/forest_admin_datasource_toolkit/utils/schema.rb
|