thecore_ui_rails_admin 3.2.2 → 3.2.3

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: 8088a7b723343583410b32514599c702b94619ac167649c9994fd28c69513add
4
- data.tar.gz: b067d7967e6514c9cf403c9cec58275653fd60dbd3c31c17559c52a21df93122
3
+ metadata.gz: 5ad379bd22ef6436935e1f5a2d33b202710f1fbf966e3c04e09d87602631dfa1
4
+ data.tar.gz: 74c6bacb910380a38fcf1c27cb5acd662b75a697e0aff27ccc07c8fc67b4f20c
5
5
  SHA512:
6
- metadata.gz: f90c196c37ac015ec28c52f53017ba0626d9ca8e53fb8955867b528d5f0e98d6249e089d31f888475d0f83bc66135b3ba2a9e7de3b302732db75143558d21e52
7
- data.tar.gz: c2c6d5b57fff5405b9fafdad93063fac96140364cf27f900c3ec4f9eef2ac04a5ea4c153adac7ef1fb1347d498ef263f953b5fa70a4ef6f5e08963d6ca9d535b
6
+ metadata.gz: f1ba6c3ae16f5b75c4fda3a083c4243397c615c7479c68f6cef0a868c4a4ffd518a50969de222e4b8ebf68b964fe452aa9c24fe10b4b12196f0dc1d7800117cf
7
+ data.tar.gz: f220d61752b9a4ac312593622cf8b41dd8012a81ba3e17e1ddd0c238f6bb5704b7b59624cf38fdebe52d04e67eddf8c82bbe9880e4eaa9a14c5e6e9c5bb28cbc
@@ -29,6 +29,8 @@ Rails.application.configure do
29
29
 
30
30
  RailsAdmin::Config::Actions::Export.send(:include, ExportConcern)
31
31
  RailsAdmin::Config::Actions::BulkDelete.send(:include, BulkDeleteConcern)
32
+ RailsAdmin::ApplicationController.send(:include, ConcernRAApplicationController)
33
+
32
34
  Role.send :include, ThecoreUiRailsAdminRoleConcern
33
35
  User.send :include, ThecoreUiRailsAdminUserConcern
34
36
  RoleUser.send :include, ThecoreUiRailsAdminRoleUserConcern
@@ -0,0 +1,42 @@
1
+ Rails.logger.debug "ApplicationController Concern from ThecoreUiCommons"
2
+ require 'active_support/concern'
3
+
4
+ module ConcernRAApplicationController
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ # Redirects on successful sign in
9
+ def after_sign_in_path_for resource
10
+ root_actions = RailsAdmin::Config::Actions.all(:root).select {|action| can? :read, action.action_name }.collect(&:action_name)
11
+
12
+ # Default root action as landing page: the first to which I have authorization to read
13
+ action = root_actions.first
14
+ Rails.logger.debug "after_sign_in_path_for action: #{action}"
15
+ # Otherwise, if I set a Manual override for landing actions in config, I can test if I'm authorized to see it
16
+ override_landing_page = Settings.ns(:main).after_sign_in_redirect_to_root_action
17
+ action = override_landing_page.to_sym if !override_landing_page.blank? && root_actions.include?(override_landing_page.to_sym)
18
+
19
+ # If I ask for a specific page, Let's try to go back there if I need to login or re-login
20
+ # This takes precedence on automatic computed action
21
+ stored_location = stored_location_for(resource)
22
+ Rails.logger.debug "after_sign_in_path_for stored_location: #{stored_location}"
23
+ if !stored_location.blank? && can?(resource, :all)
24
+ # Go to the latest navigated page
25
+ Rails.logger.debug "after_sign_in_path_for Redirect to stored_location"
26
+ return stored_location
27
+ elsif action
28
+ path = rails_admin.send("#{action}_path").sub("#{ENV['RAILS_RELATIVE_URL_ROOT']}#{ENV['RAILS_RELATIVE_URL_ROOT']}", "#{ENV['RAILS_RELATIVE_URL_ROOT']}")
29
+ Rails.logger.debug "after_sign_in_path_for Redirect to action #{path}"
30
+ return path
31
+ else
32
+ Rails.logger.debug "after_sign_in_path_for ERROR! Signing out user :-("
33
+ sign_out current_user
34
+ user_session = nil
35
+ current_user = nil
36
+ flash[:alert] = "Your user is not authorized to access any page."
37
+ flash[:notice] = nil
38
+ return root_path
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,3 +1,3 @@
1
1
  module ThecoreUiRailsAdmin
2
- VERSION = "3.2.2".freeze
2
+ VERSION = "3.2.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_ui_rails_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-17 00:00:00.000000000 Z
11
+ date: 2024-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_ui_commons
@@ -90,6 +90,7 @@ files:
90
90
  - config/initializers/after_initialize.rb
91
91
  - config/initializers/assets.rb
92
92
  - config/initializers/concern_action.rb
93
+ - config/initializers/concern_application_controller.rb
93
94
  - config/initializers/concern_bulk_delete.rb
94
95
  - config/initializers/concern_export.rb
95
96
  - config/initializers/concern_permission.rb
@@ -135,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
136
  - !ruby/object:Gem::Version
136
137
  version: '0'
137
138
  requirements: []
138
- rubygems_version: 3.5.3
139
+ rubygems_version: 3.5.11
139
140
  signing_key:
140
141
  specification_version: 4
141
142
  summary: Thecore Backend UI based on Rails Admin.