darkhelmet-role_on 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +10 -0
  2. data/VERSION +1 -1
  3. data/lib/role_on.rb +3 -0
  4. data/role_on.gemspec +1 -1
  5. 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.0
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{role_on}
5
- s.version = "0.2.0"
5
+ s.version = "0.2.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Daniel Huckstep"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: darkhelmet-role_on
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Huckstep