thecore_ui_rails_admin 3.0.6 → 3.0.7

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: 953f3462757f91a3434f925f7d49f39b222a3121ec19023cf820d4e7de446834
4
- data.tar.gz: f889522a830f2a8ef4b1a546c7b7b1bbc734e1480acbd1744240c3d979686220
3
+ metadata.gz: c92dfa0ea94b25f9ddbe39304a0c10fdb716c6d4ef271353f4c84c293b1d2d6b
4
+ data.tar.gz: 0d159f770d6078ca44c6a87c479ac9a4f5e991827cf3c720f2241b4685c558ac
5
5
  SHA512:
6
- metadata.gz: e49d5bf6d19e4a6031602cf33f03f51eb8ada43b53861383a8d05bc82ba54232e4663d73a5c51460c5e44821ce62c94f90e38891166b80c96c253bd830cf04ec
7
- data.tar.gz: 5ac31d81add4e6dc88175b725ea15c5b110e4f1693aded0790df0024b5f2a4ed18f474ec3faabdc7b3b0f8cf9c3c428be8ba817805ade646be57b1854e8390de
6
+ metadata.gz: 0b2f5b78a265e357b2d0f5a5a114e3880e9ec49fb8ee3ee89b83c43b49395722dfe022a7bfe600282624cc1bd209eef1a4330720729144da4a8f4728388d9d47
7
+ data.tar.gz: '095446452ed01a2ae2ade63d087ef86fa826fb9fcab71cd18f5cbe09ce4e0bdc2d8dcbd74817e4aa2509e2ecac8607f17c4d61f2b012c953db946e50308cb1c1'
@@ -47,7 +47,9 @@ Rails.application.configure do
47
47
  end
48
48
  end
49
49
  end
50
+
50
51
  # include the extension
52
+ ApplicationController.send(:include, ThecoreUiRailsAdminActionControllerConcern)
51
53
  RailsAdmin::Config::Actions::Export.send(:include, ExportConcern)
52
54
  RailsAdmin::Config::Actions::BulkDelete.send(:include, BulkDeleteConcern)
53
55
  Role.send :include, ThecoreUiRailsAdminRoleConcern
@@ -1,6 +1,6 @@
1
1
  require 'active_support/concern'
2
2
 
3
- module ThecoreUiRailsAdminConcern
3
+ module ThecoreUiRailsAdminActionControllerConcern
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
@@ -26,13 +26,13 @@ module ThecoreUiRailsAdminConcern
26
26
  # Redirects on successful sign in
27
27
  def after_sign_in_path_for resource
28
28
  root_actions = RailsAdmin::Config::Actions.all(:root).select {|action| can? action.action_name, :all }.collect(&:action_name)
29
-
29
+
30
30
  # Default root action as landing page: the first to which I have authorization to read
31
31
  action = root_actions.first
32
32
  # Otherwise, if I set a Manual override for landing actions in config, I can test if I'm authorized to see it
33
33
  override_landing_page = Settings.ns(:main).after_sign_in_redirect_to_root_action
34
34
  action = override_landing_page.to_sym if !override_landing_page.blank? && root_actions.include?(override_landing_page.to_sym)
35
-
35
+
36
36
  # If I ask for a specific page, Let's try to go back there if I need to login or re-login
37
37
  # This takes precedence on automatic computed action
38
38
  stored_location = stored_location_for(resource)
@@ -100,54 +100,50 @@ module ThecoreUiRailsAdminConcern
100
100
  :password_confirmation,
101
101
  :current_password)
102
102
  }
103
- end
104
-
105
- # Auto-sign out locked users
106
- def reject_locked!
107
- # Rails.logger.info "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB reject_locked"
108
- if !current_user.blank? && current_user.locked?
109
- # Rails.logger.info "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB is locked"
110
- sign_out current_user
111
- user_session = nil
112
- current_user = nil
113
- flash[:alert] = "Your account is locked."
114
- flash[:notice] = nil
115
- redirect_to root_url
116
- end
117
- # Rails.logger.info "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB is not locked = ok"
118
- end
119
-
120
-
121
- # Only permits admin users
122
- def require_admin!
123
- authenticate_user!
124
-
125
- if current_user && !current_user.admin?
126
- redirect_to inside_path
127
- end
128
- end
103
+ end
129
104
 
130
- # Its important that the location is NOT stored if:
131
- # - The request method is not GET (non idempotent)
132
- # - The request is handled by a Devise controller such as
133
- # Devise::SessionsController as that could cause an
134
- # infinite redirect loop.
135
- # - The request is an Ajax request as this can lead to very unexpected
136
- # behaviour.
137
- def storable_location?
138
- request.get? && is_navigational_format? && !devise_controller? && !request.xhr? && is_storable?
105
+ # Auto-sign out locked users
106
+ def reject_locked!
107
+ # Rails.logger.info "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB reject_locked"
108
+ if !current_user.blank? && current_user.locked?
109
+ # Rails.logger.info "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB is locked"
110
+ sign_out current_user
111
+ user_session = nil
112
+ current_user = nil
113
+ flash[:alert] = "Your account is locked."
114
+ flash[:notice] = nil
115
+ redirect_to root_url
139
116
  end
117
+ # Rails.logger.info "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB is not locked = ok"
118
+ end
119
+
120
+
121
+ # Only permits admin users
122
+ def require_admin!
123
+ authenticate_user!
140
124
 
141
- def store_user_location!
142
- # :user is the scope we are authenticating
143
- store_location_for(:user, request.fullpath)
144
- end
145
-
146
- def is_storable?
147
- true
125
+ if current_user && !current_user.admin?
126
+ redirect_to inside_path
148
127
  end
149
128
  end
150
129
 
151
- # include the extension
152
- ActionController::Base.send(:include, ThecoreUiRailsAdminConcern)
153
-
130
+ # Its important that the location is NOT stored if:
131
+ # - The request method is not GET (non idempotent)
132
+ # - The request is handled by a Devise controller such as
133
+ # Devise::SessionsController as that could cause an
134
+ # infinite redirect loop.
135
+ # - The request is an Ajax request as this can lead to very unexpected
136
+ # behaviour.
137
+ def storable_location?
138
+ request.get? && is_navigational_format? && !devise_controller? && !request.xhr? && is_storable?
139
+ end
140
+
141
+ def store_user_location!
142
+ # :user is the scope we are authenticating
143
+ store_location_for(:user, request.fullpath)
144
+ end
145
+
146
+ def is_storable?
147
+ true
148
+ end
149
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_ui_rails_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6
4
+ version: 3.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
@@ -111,8 +111,8 @@ files:
111
111
  - config/initializers/thecore_ui_rails_admin_abilities.rb
112
112
  - config/initializers/thecore_ui_rails_admin_after_initialize.rb
113
113
  - config/initializers/thecore_ui_rails_admin_app_configs.rb
114
+ - config/initializers/thecore_ui_rails_admin_application_controller_concern.rb
114
115
  - config/initializers/thecore_ui_rails_admin_assets.rb
115
- - config/initializers/thecore_ui_rails_admin_concern.rb
116
116
  - config/initializers/thecore_ui_rails_admin_invisible_models_concern.rb
117
117
  - config/initializers/thecore_ui_rails_admin_role.rb
118
118
  - config/initializers/thecore_ui_rails_admin_settings_concern.rb