forest_admin_agent 1.0.0.pre.beta.44 → 1.0.0.pre.beta.46

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: ded7762b962301e5061c77a905615c8fee282138051ecaa65f50c6d22f32c332
4
- data.tar.gz: 1c924f9b07890c13b48c6f6306dcacc6a1a117e1d83506d80b71660fc111f121
3
+ metadata.gz: 902dc1f47c4e03c5c095ed68b4ba425fe9bc4254cadf75f9f8f6a2ecbe2518c9
4
+ data.tar.gz: f005862d1078eddd5564089e7d6c0aefa6a1a8396b66d7dc9eb0f36f80bce5a2
5
5
  SHA512:
6
- metadata.gz: 1e6b48d2d0a28fa4ab8bf127d46517f36008b64554fe3e1ee8e612b565622fdf103710aeb1b164659baaa3d486578d5d6afc3262049360fc4803243edd0411d8
7
- data.tar.gz: 0e241c487a0660c1ce1e788b6eeab72881a408b3c375138081a14c5fe4c86d2a11e5544b4ed85068a3e4ff82236329acee79bcfa659621e8ca3cd363c8ff6106
6
+ metadata.gz: 484f457793fd4ac6b07419d243584293a9532b1d8d2dbb1ed04b0eb5258bf1355bfcdb3b5bbbd0bc68bb444e12792e071f1061ac037d2f9cbfbe39a74f7adf8d
7
+ data.tar.gz: 789321428f95b0f2e183be61888c890ce9b9b2feef8a7928658d16d87db3a529ed1a54936ca13b73a4bf4d4fb076bc70c615ee13fe12003806bc984b1d55ad3f
@@ -49,7 +49,6 @@ module ForestAdminAgent
49
49
  @container.resolve(:schema_file_hash).get('value') == schema[:meta][:schemaFileHash]
50
50
 
51
51
  if !schema_is_know || force
52
- # Logger::log('Info', 'schema was updated, sending new version');
53
52
  client = ForestAdminAgent::Http::ForestAdminApiRequester.new
54
53
  client.post('/forest/apimaps', schema.to_json)
55
54
  schema_file_hash_cache = FileCache.new('app', @options[:cache_dir].to_s, TTL_SCHEMA)
@@ -57,9 +56,10 @@ module ForestAdminAgent
57
56
  schema[:meta][:schemaFileHash]
58
57
  end
59
58
  @container.register(:schema_file_hash, schema_file_hash_cache)
59
+ ForestAdminAgent::Facades::Container.logger.log('Info', 'schema was updated, sending new version')
60
60
  else
61
61
  @container.resolve(:logger)
62
- # TODO: Logger::log('Info', 'Schema was not updated since last run');
62
+ ForestAdminAgent::Facades::Container.logger.log('Info', 'Schema was not updated since last run')
63
63
  end
64
64
  end
65
65
 
@@ -32,8 +32,7 @@ module ForestAdminAgent
32
32
 
33
33
  cache.delete(id_cache) unless cache.get(id_cache).nil?
34
34
 
35
- # TODO: HANDLE LOGGER
36
- # logger.debug("Invalidating #{id_cache} cache..")
35
+ ForestAdminAgent::Facades::Container.logger.log('Info', "Invalidating #{id_cache} cache..")
37
36
  end
38
37
 
39
38
  def can?(action, collection, allow_fetch: false)
@@ -66,13 +65,17 @@ module ForestAdminAgent
66
65
 
67
66
  # still not allowed - throw forbidden message
68
67
  unless is_allowed
69
- # TODO: HANDLE LOGGER
70
- # logger.debug("User #{caller.id} cannot retrieve chart on rendering #{caller.rendering_id}")
68
+ ForestAdminAgent::Facades::Container.logger.log(
69
+ 'Debug',
70
+ "User #{caller.id} cannot retrieve chart on rendering #{caller.rendering_id}"
71
+ )
71
72
  raise ForbiddenError, "You don't have permission to access this collection."
72
73
  end
73
74
 
74
- # TODO: HANDLE LOGGER
75
- # logger.debug("User #{caller.id} can retrieve chart on rendering #{caller.rendering_id}")
75
+ ForestAdminAgent::Facades::Container.logger.log(
76
+ 'Debug',
77
+ "User #{caller.id} can retrieve chart on rendering #{caller.rendering_id}"
78
+ )
76
79
 
77
80
  is_allowed
78
81
  end
@@ -93,8 +96,10 @@ module ForestAdminAgent
93
96
  )
94
97
 
95
98
  smart_action_approval.can_execute?
96
- # TODO: HANDLE LOGGER
97
- # logger.debug("User #{user_data[:roleId]} is #{is_allowed ? '' : 'not'} allowed to perform #{action['name']}")
99
+ ForestAdminAgent::Facades::Container.logger.log(
100
+ 'Debug',
101
+ "User #{user_data[:roleId]} is #{is_allowed ? "" : "not"} allowed to perform #{action["name"]}"
102
+ )
98
103
  end
99
104
 
100
105
  def get_scope(collection)
@@ -120,8 +125,7 @@ module ForestAdminAgent
120
125
  users[user[:id].to_s] = user
121
126
  end
122
127
 
123
- # TODO: HANDLE LOGGER
124
- # logger.debug('Refreshing user permissions cache')
128
+ ForestAdminAgent::Facades::Container.logger.log('Debug', 'Refreshing user permissions cache')
125
129
 
126
130
  users
127
131
  end[user_id.to_s]
@@ -146,8 +150,7 @@ module ForestAdminAgent
146
150
  collections[name] = decode_crud_permissions(collection).merge(decode_action_permissions(collection))
147
151
  end
148
152
 
149
- # TODO: HANDLE LOGGER
150
- # logger.debug('Fetching environment permissions')
153
+ ForestAdminAgent::Facades::Container.logger.log('Debug', 'Fetching environment permissions')
151
154
 
152
155
  collections
153
156
  end
@@ -164,8 +167,10 @@ module ForestAdminAgent
164
167
  stat_hash << "#{stat[:type]}:#{array_hash(stat)}"
165
168
  end
166
169
 
167
- # TODO: HANDLE LOGGER
168
- # logger.debug("Loading rendering permissions for rendering #{rendering_id}")
170
+ ForestAdminAgent::Facades::Container.logger.log(
171
+ 'Debug',
172
+ "Loading rendering permissions for rendering #{rendering_id}"
173
+ )
169
174
 
170
175
  stat_hash
171
176
  end
@@ -106,15 +106,24 @@ module ForestAdminAgent
106
106
  end
107
107
 
108
108
  def self.parse_sort(collection, args)
109
- sort_string = args.dig(:params, :sort)
109
+ raw_sort_string = args.dig(:params, :sort)
110
110
 
111
- return SortUtils::SortFactory.by_primary_keys(collection) unless sort_string
111
+ return SortUtils::SortFactory.by_primary_keys(collection) unless raw_sort_string
112
112
 
113
- sort = Sort.new([
114
- { field: sort_string.gsub(/^-/, '').tr('.', ':'), ascending: !sort_string.start_with?('-') }
115
- ])
113
+ sort_list = []
114
+ raw_sort_string.split(',').map do |sort_string|
115
+ field = sort_string.tr('.', ':')
116
+ ascending = !sort_string.start_with?('-')
117
+ field = field[1..] unless ascending
118
+
119
+ sort_list.push({ field: field, ascending: ascending })
120
+ end
121
+
122
+ sort = Sort.new(sort_list)
116
123
 
117
124
  ForestAdminDatasourceToolkit::Validations::SortValidator.validate(collection, sort)
125
+
126
+ sort
118
127
  end
119
128
  end
120
129
  end
@@ -7,7 +7,7 @@ module ForestAdminAgent
7
7
  class SchemaEmitter
8
8
  LIANA_NAME = "forest-rails"
9
9
 
10
- LIANA_VERSION = "1.0.0-beta.44"
10
+ LIANA_VERSION = "1.0.0-beta.46"
11
11
 
12
12
  def self.get_serialized_schema(datasource)
13
13
  schema_path = Facades::Container.cache(:schema_path)
@@ -15,7 +15,11 @@ module ForestAdminAgent
15
15
  schema = if schema_path && File.exist?(schema_path)
16
16
  JSON.parse(File.read(schema_path), { symbolize_names: true })
17
17
  else
18
- # TODO: Logger::log('Warn', 'The .forestadmin-schema.json file doesn\'t exist')
18
+ ForestAdminAgent::Facades::Container.logger.log(
19
+ 'Warn',
20
+ 'The .forestadmin-schema.json file doesn\'t exist'
21
+ )
22
+
19
23
  {
20
24
  meta: meta(Digest::SHA1.hexdigest('')),
21
25
  collections: {}
@@ -1,3 +1,3 @@
1
1
  module ForestAdminAgent
2
- VERSION = "1.0.0-beta.44"
2
+ VERSION = "1.0.0-beta.46"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.44
4
+ version: 1.0.0.pre.beta.46
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: 2024-05-02 00:00:00.000000000 Z
12
+ date: 2024-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport