role_authorization 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,17 +3,21 @@ RoleAuthorization::Rules.define :all do
3
3
  end
4
4
 
5
5
  RoleAuthorization::Rules.define :role do
6
- scope = if options[:scope]
7
- if options[:scope].is_a?(Proc)
8
- instance_eval(&options[:scope])
6
+ if controller_instance.current_user.blank?
7
+ false
8
+ else
9
+ scope = if options[:scope]
10
+ if options[:scope].is_a?(Proc)
11
+ instance_eval(&options[:scope])
12
+ else
13
+ options[:scope]
14
+ end
9
15
  else
10
- options[:scope]
16
+ :global
11
17
  end
12
- else
13
- :global
14
- end
15
18
 
16
- controller_instance.current_user.roles(options[:scope] || :global).include?(role)
19
+ controller_instance.current_user.roles(options[:scope] || :global).include?(role)
20
+ end
17
21
  end
18
22
 
19
23
  RoleAuthorization::Rules.define :user do
@@ -1,3 +1,3 @@
1
1
  module RoleAuthorization
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: role_authorization
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.2
5
+ version: 0.3.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - John 'asceth' Long