darkhelmet-role_on 0.2.0 → 0.2.1
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.
- data/README.md +10 -0
- data/VERSION +1 -1
- data/lib/role_on.rb +3 -0
- data/role_on.gemspec +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -64,6 +64,16 @@ Can specify :sa to allow a 'superadmin' to gain access even if they don't have t
|
|
64
64
|
|
65
65
|
In that case, users who either have the :foo_admin or :super_admin role will have access
|
66
66
|
|
67
|
+
You can also define a role_on_defaults method on things to define default arguments
|
68
|
+
|
69
|
+
In application_controller:
|
70
|
+
|
71
|
+
def role_on_defaults
|
72
|
+
{ :sa => :my_sa_role }
|
73
|
+
end
|
74
|
+
|
75
|
+
In all sub controllers, :my_sa_role will be the value of :sa. This can be overridden.
|
76
|
+
|
67
77
|
# License
|
68
78
|
|
69
79
|
See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/role_on.rb
CHANGED
@@ -2,6 +2,9 @@ module RoleOn
|
|
2
2
|
module RoleOnControllerMethods
|
3
3
|
def role_on(role, options = {})
|
4
4
|
before_filter do |c|
|
5
|
+
if c.respond_to?(:role_on_defaults)
|
6
|
+
options = c.role_on_defaults.merge(options)
|
7
|
+
end
|
5
8
|
action = c.params[:action].intern
|
6
9
|
user_roles = c.current_user.roles.map(&:name).map(&:intern)
|
7
10
|
restricted_actions = if options.include?(:on)
|
data/role_on.gemspec
CHANGED