rarbac 0.0.1 → 0.0.2
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/README.md +3 -1
- data/app/helpers/rarbac/application_helper.rb +2 -3
- data/lib/rarbac/version.rb +1 -1
- 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: ce43d1567a57a30f8b620d6e1170cf20f74dd7be
|
4
|
+
data.tar.gz: 5f0157aa6b2e5344afcbcfb4fc3b91e27cc79294
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cb575153cbfd401d280ce2f30952b31391dc269ca8062dd16c9416280c887ee2a1a3685b3a4da9d7621297522466c5c7be6537e4dfc66853f575b8b58335ca5
|
7
|
+
data.tar.gz: 791b13437baf4522404da91606ced01f6e92a168a0a1fc7cf15559255cb21809a8d20cb1d4319bfe0e26d50f7a6c56ff7647f6e25e1db74b559579ac825d7c95
|
data/README.md
CHANGED
@@ -96,7 +96,9 @@ You may add `before_filter :ensure_permission!` to create role-based authorizati
|
|
96
96
|
on the controller and action being executed. For example:
|
97
97
|
|
98
98
|
```ruby
|
99
|
-
class PostsController <
|
99
|
+
class PostsController < ApplicationController::Base
|
100
|
+
include Rarbac::ApplicationHelper
|
101
|
+
|
100
102
|
before_filter :ensure_permission!
|
101
103
|
|
102
104
|
def show
|
@@ -33,9 +33,8 @@ module Rarbac
|
|
33
33
|
# the result of the role check.
|
34
34
|
def ensure_permission!(action=nil, &block)
|
35
35
|
unless action
|
36
|
-
|
37
|
-
|
38
|
-
# name to check.
|
36
|
+
klass = self.class.name.underscore.sub("_controller", "")
|
37
|
+
action = "#{klass}##{action_name}"
|
39
38
|
end
|
40
39
|
|
41
40
|
has_something?(:has_permission?, action, block)
|
data/lib/rarbac/version.rb
CHANGED