tkh_authentication 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md
CHANGED
@@ -16,12 +16,16 @@ module TkhAuthenticationActionControllerExtension
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def authenticate_with_admin
|
19
|
-
unless
|
19
|
+
unless administrator?
|
20
20
|
session[:target_page] = request.url if session[:target_page].nil?
|
21
21
|
redirect_to safe_root_url, alert: t('authentication.warning.restricted_access')
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
def administrator?
|
26
|
+
current_user && current_user.admin?
|
27
|
+
end
|
28
|
+
|
25
29
|
private
|
26
30
|
|
27
31
|
def safe_root_url
|
@@ -6,9 +6,14 @@ module TkhAuthenticationHelper
|
|
6
6
|
end
|
7
7
|
|
8
8
|
module InstanceMethods
|
9
|
-
# duplicated
|
9
|
+
# duplicated from action controller extension. there must be a better way
|
10
10
|
def current_user
|
11
11
|
@current_user ||= User.find_by_auth_token!(cookies[:auth_token]) if cookies[:auth_token]
|
12
12
|
end
|
13
|
+
|
14
|
+
# duplicated from action controller extension. there must be a better way
|
15
|
+
def administrator?
|
16
|
+
@administrator ||= current_user && current_user.admin?
|
17
|
+
end
|
13
18
|
end
|
14
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tkh_authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
segments:
|
174
174
|
- 0
|
175
|
-
hash:
|
175
|
+
hash: 3442867698929455310
|
176
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
177
|
none: false
|
178
178
|
requirements:
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
segments:
|
183
183
|
- 0
|
184
|
-
hash:
|
184
|
+
hash: 3442867698929455310
|
185
185
|
requirements: []
|
186
186
|
rubyforge_project:
|
187
187
|
rubygems_version: 1.8.23
|