thecore_ui_rails_admin 3.0.9 → 3.0.11
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: 4bf27ee7eca3087e172ee00292bf64da89ec995b08f6d66bd4f40ff4a206b5a6
|
4
|
+
data.tar.gz: d54c5989b45da0031062d4e301d5e349e756d6edb0f2059b1abe767dc435ec46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f148d09a4a1748828a8e16fcdd09f6d9a187a03cfb3923ca71d396e54365ae2bd75d8aa9ecc8c1cf6cd8522355af945ca9dd0dffee1ff4c91722b936786e5681
|
7
|
+
data.tar.gz: b3edfd4c67221520f5aff672dd9d5c3147eeef47c14e9dc48d944dce7de521c75774e9d530052a1c206d3ef7495714560cd737a87168f28bcf4e96a006091c1a
|
@@ -4,17 +4,15 @@ Rails.application.configure do
|
|
4
4
|
RailsAdmin::Config.sidescroll = { num_frozen_columns: 2 }
|
5
5
|
|
6
6
|
RailsAdmin::Config.main_app_name = Proc.new { |controller| [ ((ENV["APP_NAME"].presence || Settings.app_name.presence) rescue "Thecore"), "" ] }
|
7
|
-
# Link for background Job
|
8
|
-
# (config.navigation_static_links ||= {}).merge! "Background Monitor" => "#{ENV["BACKEND_URL"].presence || "http://localhost:3000"}/sidekiq"
|
9
7
|
|
10
|
-
### Popular gems integration
|
11
|
-
## == Devise ==
|
12
|
-
RailsAdmin::Config.authenticate_with { warden.authenticate! scope: :user }
|
8
|
+
# ### Popular gems integration
|
9
|
+
# # ## == Devise ==
|
10
|
+
# RailsAdmin::Config.authenticate_with { warden.authenticate! scope: :user }
|
13
11
|
|
14
|
-
RailsAdmin::Config.current_user_method(&:current_user)
|
12
|
+
# RailsAdmin::Config.current_user_method(&:current_user)
|
15
13
|
|
16
|
-
## == Cancan ==
|
17
|
-
RailsAdmin::Config.authorize_with :cancancan
|
14
|
+
# # ## == Cancan ==
|
15
|
+
# RailsAdmin::Config.authorize_with :cancancan
|
18
16
|
|
19
17
|
## == PaperTrail ==
|
20
18
|
# config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0
|
@@ -2,13 +2,15 @@ require 'active_support/concern'
|
|
2
2
|
|
3
3
|
module ThecoreUiRailsAdminActionControllerConcern
|
4
4
|
extend ActiveSupport::Concern
|
5
|
-
|
5
|
+
|
6
6
|
included do
|
7
7
|
# Prevent CSRF attacks by raising an exception.
|
8
8
|
# For APIs, you may want to use :null_session instead.
|
9
9
|
# layout 'thecore'
|
10
|
-
puts "Protecting from Forgery with exception and prepend
|
11
|
-
protect_from_forgery with: :
|
10
|
+
puts "Protecting from Forgery with exception and prepend"
|
11
|
+
# protect_from_forgery with: :reset_session
|
12
|
+
skip_forgery_protection
|
13
|
+
|
12
14
|
rescue_from CanCan::AccessDenied do |exception|
|
13
15
|
redirect_to main_app.root_url, alert: exception.message
|
14
16
|
end
|
@@ -17,7 +19,6 @@ module ThecoreUiRailsAdminActionControllerConcern
|
|
17
19
|
before_action :store_user_location!, if: :storable_location?
|
18
20
|
before_action :configure_permitted_parameters, if: :devise_controller?
|
19
21
|
before_action :reject_locked!, if: :devise_controller?
|
20
|
-
before_action :debug_csrf
|
21
22
|
|
22
23
|
helper_method :reject_locked!
|
23
24
|
helper_method :require_admin!
|
@@ -106,9 +107,9 @@ module ThecoreUiRailsAdminActionControllerConcern
|
|
106
107
|
|
107
108
|
# Auto-sign out locked users
|
108
109
|
def reject_locked!
|
109
|
-
|
110
|
+
puts "reject_locked #{current_user}"
|
110
111
|
if !current_user.blank? && current_user.locked?
|
111
|
-
|
112
|
+
puts " - Cleaning session"
|
112
113
|
sign_out current_user
|
113
114
|
user_session = nil
|
114
115
|
current_user = nil
|
@@ -122,6 +123,7 @@ module ThecoreUiRailsAdminActionControllerConcern
|
|
122
123
|
|
123
124
|
# Only permits admin users
|
124
125
|
def require_admin!
|
126
|
+
puts "require_admin! #{current_user}"
|
125
127
|
authenticate_user!
|
126
128
|
|
127
129
|
if current_user && !current_user.admin?
|
@@ -148,9 +150,4 @@ module ThecoreUiRailsAdminActionControllerConcern
|
|
148
150
|
def is_storable?
|
149
151
|
true
|
150
152
|
end
|
151
|
-
|
152
|
-
def debug_csrf
|
153
|
-
puts "CSRF: #{params["authenticity_token"]}"
|
154
|
-
puts "Authenticity Token #{ENV["SECRET_KEY_BASE"]}"
|
155
|
-
end
|
156
153
|
end
|
@@ -21,12 +21,12 @@ module ThecoreUiRailsAdminUserConcern
|
|
21
21
|
end
|
22
22
|
field :admin do
|
23
23
|
visible do
|
24
|
-
bindings[:view].current_user.admin? && bindings[:view].current_user.id != bindings[:object].id
|
24
|
+
bindings[:view].current_user.admin? && bindings[:view].current_user.id != bindings[:object].id rescue false
|
25
25
|
end
|
26
26
|
end
|
27
27
|
field :locked do
|
28
28
|
visible do
|
29
|
-
bindings[:view].current_user.admin? && bindings[:view].current_user.id != bindings[:object].id
|
29
|
+
bindings[:view].current_user.admin? && bindings[:view].current_user.id != bindings[:object].id rescue false
|
30
30
|
end
|
31
31
|
end
|
32
32
|
field :roles#, :selectize
|