thecore_ui_commons 3.1.5 → 3.1.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17becbd7643a00bc0b677088ef7a5d04e6a56b2648be95541236c8496c12e73a
|
4
|
+
data.tar.gz: f521be59ee4be146f8c27ff318ede3db9476b37d27716ef19dc5b3d4dbdb6054
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccf8b726e8e78b02f5c5b438ba2ec187777c8942eaaff07afe3ac495c066c5e57a68c8a7777e3bc7b0035ff224aec41653f1157009298c51a608be3bdd405fa4
|
7
|
+
data.tar.gz: 824474d33a95711a0ebbf1dccc61d971d06f2ef0f41b852354158cd76e86d60b45949701042fe98e9e5a4cab6b69529344ee9454b2cb6b84d359953dd4f42b8d
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Rails.application.configure do
|
2
2
|
config.after_initialize do
|
3
3
|
# Controllers
|
4
|
-
ApplicationController.send
|
5
|
-
RailsAdmin::ApplicationController.send :include, ConcernApplicationController
|
4
|
+
ApplicationController.send(:include, ConcernCommonApplicationController)
|
6
5
|
User.send(:include, ThecoreUiCommonsUserConcern)
|
6
|
+
RailsAdmin::ApplicationController.send(:include, ConcernCommonApplicationController)
|
7
7
|
end
|
8
8
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
Rails.logger.debug "ApplicationController Concern from ThecoreUiCommons"
|
2
2
|
require 'active_support/concern'
|
3
3
|
|
4
|
-
module
|
4
|
+
module ConcernCommonApplicationController
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
included do
|
@@ -15,44 +15,10 @@ module ConcernApplicationController
|
|
15
15
|
before_action :store_user_location!, if: :storable_location?
|
16
16
|
before_action :reject_locked!, if: :devise_controller?
|
17
17
|
|
18
|
-
# Redirects on successful sign in
|
19
|
-
def after_sign_in_path_for resource
|
20
|
-
root_actions = RailsAdmin::Config::Actions.all(:root).select {|action| can? action.action_name, :all }.collect(&:action_name)
|
21
|
-
|
22
|
-
# Default root action as landing page: the first to which I have authorization to read
|
23
|
-
action = root_actions.first
|
24
|
-
puts "after_sign_in_path_for action: #{action}"
|
25
|
-
# Otherwise, if I set a Manual override for landing actions in config, I can test if I'm authorized to see it
|
26
|
-
override_landing_page = Settings.ns(:main).after_sign_in_redirect_to_root_action
|
27
|
-
action = override_landing_page.to_sym if !override_landing_page.blank? && root_actions.include?(override_landing_page.to_sym)
|
28
|
-
|
29
|
-
# If I ask for a specific page, Let's try to go back there if I need to login or re-login
|
30
|
-
# This takes precedence on automatic computed action
|
31
|
-
stored_location = stored_location_for(resource)
|
32
|
-
puts "after_sign_in_path_for stored_location: #{stored_location}"
|
33
|
-
if !stored_location.blank? && can?(resource, :all)
|
34
|
-
# Go to the latest navigated page
|
35
|
-
puts "after_sign_in_path_for Redirect to stored_location"
|
36
|
-
return stored_location
|
37
|
-
elsif action
|
38
|
-
path = rails_admin.send("#{action}_path").sub("#{ENV['RAILS_RELATIVE_URL_ROOT']}#{ENV['RAILS_RELATIVE_URL_ROOT']}", "#{ENV['RAILS_RELATIVE_URL_ROOT']}")
|
39
|
-
puts "after_sign_in_path_for Redirect to action #{path}"
|
40
|
-
return path
|
41
|
-
else
|
42
|
-
puts "after_sign_in_path_for ERROR! Signing out user :-("
|
43
|
-
sign_out current_user
|
44
|
-
user_session = nil
|
45
|
-
current_user = nil
|
46
|
-
flash[:alert] = "Your user is not authorized to access any page."
|
47
|
-
flash[:notice] = nil
|
48
|
-
return root_path
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
18
|
# Auto-sign out locked users
|
53
19
|
def reject_locked!
|
54
20
|
if !current_user.blank? && current_user.locked?
|
55
|
-
|
21
|
+
Rails.logger.debug " - Cleaning session"
|
56
22
|
sign_out current_user
|
57
23
|
user_session = nil
|
58
24
|
current_user = nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_ui_commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.6
|
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-07-
|
11
|
+
date: 2024-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_backend_commons
|