thecore_ui_rails_admin 2.5.6 → 2.5.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/initializers/thecore_concern.rb +15 -13
- data/db/seeds.rb +1 -0
- data/lib/concerns/thecore_ui_rails_admin_permission.rb +13 -12
- data/lib/concerns/thecore_ui_rails_admin_role.rb +14 -13
- data/lib/concerns/thecore_ui_rails_admin_user.rb +6 -6
- data/lib/thecore_ui_rails_admin/engine.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 436b2fd4b12a451fa58e3bc437e00496889f94e65bcf848e20421fcb574d87b3
|
4
|
+
data.tar.gz: ddc400dcdc47f218eb6580eaf46ee4675a0e2fa6abca4c9106e0a8df1508cbae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b84789f3dd2c7ae33194df07f61d505ca746654cb9319d4bbc2c4d11f33739821402a54ee214cb5780dd82e590b7ef6ec11edde1f37232b40beed9dda8bc9263
|
7
|
+
data.tar.gz: 973c3192ffb95474ccabccd89c183d6312c31f74a907aab56727596fe9a14e8b12bbfd167e40df46f9d8485bc448b694223ef80aeef03cedb2dd25980dec3d98
|
@@ -24,25 +24,23 @@ module ThecoreConcern
|
|
24
24
|
|
25
25
|
# Redirects on successful sign in
|
26
26
|
def after_sign_in_path_for resource
|
27
|
-
|
28
|
-
#if current_user.admin?
|
29
|
-
# GETTING JUST THE ROOT ACTIONS I (CURRENT_USER) CAN MANAGE
|
30
|
-
root_actions = RailsAdmin::Config::Actions.all(:root).select {|action| can? action.action_name, :all }
|
31
|
-
# Rails.logger.debug "ROOT ACTIONS: #{root_actions.inspect}"
|
32
|
-
# GETTING THE FIRST ACTION I CAN MANAGE
|
33
|
-
action = root_actions.collect(&:action_name).first
|
34
|
-
# REDIRECT TO THAT ACTION
|
27
|
+
root_actions = RailsAdmin::Config::Actions.all(:root).select {|action| can? action.action_name, :all }.collect(&:action_name)
|
35
28
|
|
36
|
-
#
|
29
|
+
# Default root action as landing page: the first to which I have authorization to read
|
30
|
+
action = root_actions.first
|
31
|
+
# Otherwise, if I set a Manual override for landing actions in config, I can test if I'm authorized to see it
|
32
|
+
override_landing_page = Settings.ns(:main).after_sign_in_redirect_to_root_action
|
33
|
+
action = override_landing_page.to_sym if !override_landing_page.blank? && root_actions.include?(override_landing_page.to_sym)
|
34
|
+
|
35
|
+
# If I ask for a specific page, Let's try to go back there if I need to login or re-login
|
36
|
+
# This takes precedence on automatic computed action
|
37
37
|
stored_location = stored_location_for(resource)
|
38
38
|
if !stored_location.blank? && can?(resource, :all)
|
39
|
-
#
|
39
|
+
# Go to the latest navigated page
|
40
40
|
return stored_location
|
41
41
|
elsif action
|
42
|
-
# Rails.logger.info "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: Checking redirect path: I'm in the ELSIF with action name: #{action}"
|
43
42
|
return rails_admin.send("#{action}_path").sub("#{ENV['RAILS_RELATIVE_URL_ROOT']}#{ENV['RAILS_RELATIVE_URL_ROOT']}", "#{ENV['RAILS_RELATIVE_URL_ROOT']}")
|
44
43
|
else
|
45
|
-
# Rails.logger.info "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA: Checking redirect path: I'm in the ELSE with root_path: #{root_path}"
|
46
44
|
sign_out current_user
|
47
45
|
user_session = nil
|
48
46
|
current_user = nil
|
@@ -136,13 +134,17 @@ module ThecoreConcern
|
|
136
134
|
# - The request is an Ajax request as this can lead to very unexpected
|
137
135
|
# behaviour.
|
138
136
|
def storable_location?
|
139
|
-
request.get? && is_navigational_format? && !devise_controller? && !request.xhr?
|
137
|
+
request.get? && is_navigational_format? && !devise_controller? && !request.xhr? && is_storable?
|
140
138
|
end
|
141
139
|
|
142
140
|
def store_user_location!
|
143
141
|
# :user is the scope we are authenticating
|
144
142
|
store_location_for(:user, request.fullpath)
|
145
143
|
end
|
144
|
+
|
145
|
+
def is_storable?
|
146
|
+
true
|
147
|
+
end
|
146
148
|
end
|
147
149
|
|
148
150
|
# include the extension
|
data/db/seeds.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Thecore::Seed.save_setting :main, :after_sign_in_redirect_to_root_action, ""
|
@@ -9,24 +9,25 @@ module ThecoreUiRailsAdminPermission
|
|
9
9
|
field :predicate
|
10
10
|
field :action
|
11
11
|
field :target
|
12
|
+
field :lock_version
|
12
13
|
list do
|
13
14
|
field :created_at
|
14
|
-
exclude_fields :lock_version
|
15
|
+
# exclude_fields :lock_version
|
15
16
|
end
|
16
17
|
show do
|
17
18
|
exclude_fields :id
|
18
|
-
exclude_fields :lock_version
|
19
|
-
end
|
20
|
-
create do
|
21
|
-
field :lock_version, :hidden do
|
22
|
-
visible true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
edit do
|
26
|
-
field :lock_version, :hidden do
|
27
|
-
visible true
|
28
|
-
end
|
19
|
+
# exclude_fields :lock_version
|
29
20
|
end
|
21
|
+
# create do
|
22
|
+
# field :lock_version, :hidden do
|
23
|
+
# visible true
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
# edit do
|
27
|
+
# field :lock_version, :hidden do
|
28
|
+
# visible true
|
29
|
+
# end
|
30
|
+
# end
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
@@ -12,25 +12,26 @@ module ThecoreUiRailsAdminRole
|
|
12
12
|
|
13
13
|
field :name
|
14
14
|
field :permissions#, :selectize
|
15
|
+
|
15
16
|
list do
|
16
17
|
field :created_at
|
17
|
-
exclude_fields :lock_version
|
18
|
+
# exclude_fields :lock_version
|
18
19
|
end
|
19
20
|
show do
|
20
21
|
exclude_fields :id
|
21
|
-
exclude_fields :lock_version
|
22
|
-
end
|
23
|
-
create do
|
24
|
-
field :lock_version, :hidden do
|
25
|
-
visible true
|
26
|
-
end
|
27
|
-
# include UserRailsAdminCreateConcern
|
28
|
-
end
|
29
|
-
edit do
|
30
|
-
field :lock_version, :hidden do
|
31
|
-
visible true
|
32
|
-
end
|
22
|
+
# exclude_fields :lock_version
|
33
23
|
end
|
24
|
+
# create do
|
25
|
+
# field :lock_version, :hidden do
|
26
|
+
# visible true
|
27
|
+
# end
|
28
|
+
# # include UserRailsAdminCreateConcern
|
29
|
+
# end
|
30
|
+
# edit do
|
31
|
+
# field :lock_version, :hidden do
|
32
|
+
# visible true
|
33
|
+
# end
|
34
|
+
# end
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
@@ -61,9 +61,9 @@ module ThecoreUiRailsAdminUser
|
|
61
61
|
field :password_confirmation do
|
62
62
|
required true
|
63
63
|
end
|
64
|
-
field :lock_version, :hidden do
|
65
|
-
|
66
|
-
end
|
64
|
+
# field :lock_version, :hidden do
|
65
|
+
# visible true
|
66
|
+
# end
|
67
67
|
# include UserRailsAdminCreateConcern
|
68
68
|
end
|
69
69
|
edit do
|
@@ -74,9 +74,9 @@ module ThecoreUiRailsAdminUser
|
|
74
74
|
required false
|
75
75
|
end
|
76
76
|
|
77
|
-
field :lock_version, :hidden do
|
78
|
-
|
79
|
-
end
|
77
|
+
# field :lock_version, :hidden do
|
78
|
+
# visible true
|
79
|
+
# end
|
80
80
|
# include UserRailsAdminEditConcern
|
81
81
|
|
82
82
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module ThecoreUiRailsAdmin
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
initializer 'thecore_ui_rails_admin.add_to_migrations' do |app|
|
4
|
+
Thecore::Base.thecore_engines << self.class
|
4
5
|
unless app.root.to_s.match root.to_s
|
5
6
|
# APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
|
6
7
|
config.paths['db/migrate'].expanded.each do |expanded_path|
|
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: 2.5.
|
4
|
+
version: 2.5.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_ui_commons
|
@@ -183,6 +183,7 @@ files:
|
|
183
183
|
- config/locales/it.rails_admin.yml
|
184
184
|
- config/locales/it.rollincode.yml
|
185
185
|
- config/routes.rb
|
186
|
+
- db/seeds.rb
|
186
187
|
- lib/abilities/thecore_ui_rails_admin.rb
|
187
188
|
- lib/concerns/rails_admin_requirements.rb
|
188
189
|
- lib/concerns/thecore_rails_admin_bulk_delete_concern.rb
|