motor-admin 0.2.4 → 0.2.8

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: edbfc97ab1d4085b7ba5f36556ccb8a2cc8a296adfc5faf39575d222b5d01437
4
- data.tar.gz: 5fea122265af6b1dec8085938c7b8b4232307947f6eedcf8edbbf0427689068a
3
+ metadata.gz: 17e18a7f05b5872257978713dc9bb51c5c19823ec07eed5dd4e2a5035817ab96
4
+ data.tar.gz: a1cc9b42cabbc9278a43abaad16a5987847b162b6e04177c25fbaa5438ff3bf8
5
5
  SHA512:
6
- metadata.gz: 1819ab43fc6a0ec3f6b9dc12da4b640e11be04a0009396078ef35c0ecd77a5641bef949dc78c37637eb71a3ea4486c93b39e8bd35f36e72842445b74bb848177
7
- data.tar.gz: 19491ffe428b4cf741746af9001d641a571cc0a12f36e6a6dac586d0ad80534be06078bae765755acf1e74cebee2ae9680f0f9f74113db5ad7bd0963ae6dd21c
6
+ metadata.gz: 698d0a1d1b9ae1b2f4589decff0cc54fbae9c49a61a553504963ef71c8a02ecae656dd6a7a163cb28af4ee65155cff31b8240237b5ff6a58a0de76597beff2f4
7
+ data.tar.gz: c07b294604ec27c76f35f55f69a0c592a7dd349a6b446efd724090c2eac1e07d71e24785ca4bdb80e960a51735e923bb62775c6b477c375446b19ae40185c505
@@ -18,6 +18,12 @@ module Motor
18
18
 
19
19
  render json: { errors: [e.message] }, status: :internal_server_error
20
20
  end
21
+
22
+ rescue_from CanCan::AccessDenied do |e|
23
+ Rails.logger.error(e)
24
+
25
+ render json: { errors: [e.message] }, status: :forbidden
26
+ end
21
27
  end
22
28
  end
23
29
  end
@@ -16,6 +16,8 @@ if Rails::VERSION::MAJOR == 6
16
16
  end
17
17
 
18
18
  def build_filters(manager, alias_tracker)
19
+ return unless @filters
20
+
19
21
  where_clause = nil
20
22
 
21
23
  @filters.each do |filters|
data/lib/motor/admin.rb CHANGED
@@ -45,7 +45,7 @@ module Motor
45
45
  initializer 'motor.alerts.scheduler' do
46
46
  config.after_initialize do
47
47
  next unless Motor.server?
48
- next if Motor.development?
48
+ next unless Rails.env.production?
49
49
 
50
50
  Motor::Alerts::Scheduler::SCHEDULER_TASK.execute
51
51
  end
@@ -45,9 +45,7 @@ module Motor
45
45
 
46
46
  def select_columns(columns)
47
47
  selected_columns =
48
- columns.select do |name|
49
- BuildSchema::FindDisplayColumn::DISPLAY_NAME_REGEXP.match?(name)
50
- end.presence
48
+ columns.grep(BuildSchema::FindDisplayColumn::DISPLAY_NAME_REGEXP).presence
51
49
 
52
50
  selected_columns ||= columns.first(SELECT_COLUMNS_AMOUNT)
53
51
 
@@ -4,6 +4,8 @@ module Motor
4
4
  module CancanUtils
5
5
  module AbilityPatch
6
6
  def serialized_rules
7
+ return [] unless @rules
8
+
7
9
  @rules.map do |rule|
8
10
  {
9
11
  base_behavior: rule.base_behavior,
@@ -13,7 +13,7 @@ module Motor
13
13
  module_function
14
14
 
15
15
  def call(current_user = nil, current_ability = nil, cache_keys: LoadFromCache.load_cache_keys)
16
- CACHE_STORE.fetch("#{I18n.locale}#{cache_keys.hash}#{current_user&.id}") do
16
+ CACHE_STORE.fetch("#{I18n.locale}#{cache_keys.hash}#{current_user&.id}#{current_ability&.rules_hash}") do
17
17
  CACHE_STORE.clear
18
18
 
19
19
  data = build_data(cache_keys, current_user, current_ability)
@@ -14,7 +14,7 @@ module Motor
14
14
 
15
15
  maybe_fetch_from_cache(
16
16
  model,
17
- cache_key,
17
+ cache_key.to_s + model.object_id.to_s,
18
18
  lambda {
19
19
  resource_config = configs.find { |r| r.name == model.name.underscore }
20
20
 
data/lib/motor/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Motor
4
- VERSION = '0.2.4'
4
+ VERSION = '0.2.8'
5
5
  end
@@ -2601,9 +2601,9 @@
2601
2601
  "icons/zoom-out.svg.gz": "icons/zoom-out.svg.gz",
2602
2602
  "icons/zoom-question.svg": "icons/zoom-question.svg",
2603
2603
  "icons/zoom-question.svg.gz": "icons/zoom-question.svg.gz",
2604
- "main-32da50c51ef9fcddf634.css.gz": "main-32da50c51ef9fcddf634.css.gz",
2605
- "main-32da50c51ef9fcddf634.js.LICENSE.txt": "main-32da50c51ef9fcddf634.js.LICENSE.txt",
2606
- "main-32da50c51ef9fcddf634.js.gz": "main-32da50c51ef9fcddf634.js.gz",
2607
- "main.css": "main-32da50c51ef9fcddf634.css",
2608
- "main.js": "main-32da50c51ef9fcddf634.js"
2604
+ "main-c332e3fdad0c8e350a4c.css.gz": "main-c332e3fdad0c8e350a4c.css.gz",
2605
+ "main-c332e3fdad0c8e350a4c.js.LICENSE.txt": "main-c332e3fdad0c8e350a4c.js.LICENSE.txt",
2606
+ "main-c332e3fdad0c8e350a4c.js.gz": "main-c332e3fdad0c8e350a4c.js.gz",
2607
+ "main.css": "main-c332e3fdad0c8e350a4c.css",
2608
+ "main.js": "main-c332e3fdad0c8e350a4c.js"
2609
2609
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motor-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Matsyburka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-07 00:00:00.000000000 Z
11
+ date: 2021-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord-filter
@@ -1523,8 +1523,8 @@ files:
1523
1523
  - ui/dist/icons/zoom-money.svg.gz
1524
1524
  - ui/dist/icons/zoom-out.svg.gz
1525
1525
  - ui/dist/icons/zoom-question.svg.gz
1526
- - ui/dist/main-32da50c51ef9fcddf634.css.gz
1527
- - ui/dist/main-32da50c51ef9fcddf634.js.gz
1526
+ - ui/dist/main-c332e3fdad0c8e350a4c.css.gz
1527
+ - ui/dist/main-c332e3fdad0c8e350a4c.js.gz
1528
1528
  - ui/dist/manifest.json
1529
1529
  homepage:
1530
1530
  licenses: