wagon_rails 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wagon_rails/version.rb +1 -1
- data/templates/Gemfile.erb +1 -1
- data/templates/application_controller.rb +10 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ba116e82293e08bdb66abf7e45f84b94d1dbab6
|
4
|
+
data.tar.gz: b079515bf7dde618d2b187243ff2cdf1f90b5b68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeac743f94dad21d250252bbada19636192f984d6a04dd839cb9f5a59c25e4d3933dd23eaafbde3c2122fc89304b853365bd05bf0226c90958a1c8939bf3dc7c
|
7
|
+
data.tar.gz: a53b1d688fdddc6d907fa7eadbfb36bfedc003038f146bc3a9a46c1b78ccc0eceb3fa95575ea47284ac2bd64363fb8e7f2ffab956802d03dd50582b11837af4d
|
data/lib/wagon_rails/version.rb
CHANGED
data/templates/Gemfile.erb
CHANGED
@@ -1,20 +1,17 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
|
+
include Pundit
|
3
|
+
|
2
4
|
protect_from_forgery with: :exception
|
3
|
-
before_filter :authenticate_user!, unless: :pages_controller?
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
before_action :authenticate_user!, unless: :pages_controller?
|
7
|
+
|
8
|
+
after_action :verify_authorized, except: :index, unless: :devise_or_pages_controller?
|
7
9
|
after_action :verify_policy_scoped, only: :index, unless: :devise_or_pages_controller?
|
8
10
|
|
9
11
|
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
10
12
|
|
11
13
|
private
|
12
14
|
|
13
|
-
def user_not_authorized
|
14
|
-
flash[:error] = I18n.t('controllers.application.user_not_authorized', default: "You can't access this page.")
|
15
|
-
redirect_to(root_path)
|
16
|
-
end
|
17
|
-
|
18
15
|
def devise_or_pages_controller?
|
19
16
|
devise_controller? || pages_controller?
|
20
17
|
end
|
@@ -22,4 +19,9 @@ class ApplicationController < ActionController::Base
|
|
22
19
|
def pages_controller?
|
23
20
|
controller_name == "pages" # Brought by the `high_voltage` gem
|
24
21
|
end
|
22
|
+
|
23
|
+
def user_not_authorized
|
24
|
+
flash[:error] = I18n.t('controllers.application.user_not_authorized', default: "You can't access this page.")
|
25
|
+
redirect_to(root_path)
|
26
|
+
end
|
25
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wagon_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ssaunier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|