role_authorization 0.5.7 → 0.5.8
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.
@@ -82,6 +82,26 @@ module RoleAuthorization
|
|
82
82
|
enroll(value)
|
83
83
|
end
|
84
84
|
|
85
|
+
# mass enroll based on scope
|
86
|
+
def roles=(role_names, scope = nil)
|
87
|
+
# first get rid of all scoped roles
|
88
|
+
scope_key, scope_id = scope_with(scope)
|
89
|
+
self.serialized_roles ||= Hash.new
|
90
|
+
|
91
|
+
if scope_key.nil?
|
92
|
+
self.serialized_roles[:global] = Array.new
|
93
|
+
else
|
94
|
+
if scope_id.nil?
|
95
|
+
self.serialized_roles[scope_key] = Array.new
|
96
|
+
else
|
97
|
+
self.serialized_roles[scope_key] ||= Hash.new
|
98
|
+
self.serialized_roles[scope_key][scope_id] = Array.new
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
role_names.map {|role_name| enroll(role_name, scope)}
|
103
|
+
end
|
104
|
+
|
85
105
|
# adds a role to the user
|
86
106
|
def enroll(role_name, scope = nil)
|
87
107
|
return true if has_role?(role_name.to_sym, scope)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: role_authorization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-11-11 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &22356720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *22356720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rr
|
27
|
-
requirement: &
|
27
|
+
requirement: &22356300 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *22356300
|
36
36
|
description: A gem for handling authorization in rails using roles
|
37
37
|
email:
|
38
38
|
- machinist@asceth.com
|