route_authorizer 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/route_authorizer/authorizer.rb +7 -1
- data/lib/route_authorizer/version.rb +1 -1
- data/lib/route_authorizer.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03917bb50ef8c090257e8517adeba2647738ee55
|
4
|
+
data.tar.gz: f0c27426804ef97d9c58390cbba72fac3660820c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31d86741194eb317a30120bfc30b761cb9ce0438f0b5728d7faa6022878fdcd5edbbbeb0a09c7e62d41e2583e6c92c52769a087291a66fd1a8cabdf197350e77
|
7
|
+
data.tar.gz: ba84579744255ef98a422e1a5e917e332ad09f9831cd183e6dd208961950a9f6dd8f3b231809aa81cbbe2930a41090c2f6c31f669fe083d7ea90f55f07d4332c
|
@@ -10,8 +10,12 @@ module RouteAuthorizer::Authorizer
|
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
|
+
def permission
|
14
|
+
@permission ||= ::Permission.new(current_user.role)
|
15
|
+
end
|
16
|
+
|
13
17
|
def can_redirect_to?(_controller_name, _action_name)
|
14
|
-
|
18
|
+
permission.redirect_to?(_controller_name, _action_name) if current_user
|
15
19
|
end
|
16
20
|
|
17
21
|
def can_redirect_to_path?(path)
|
@@ -26,3 +30,5 @@ private
|
|
26
30
|
end
|
27
31
|
|
28
32
|
end
|
33
|
+
|
34
|
+
ActionController::Base.include(RouteAuthorizer::Authorizer)
|
data/lib/route_authorizer.rb
CHANGED