role_authorization 0.2.1 → 0.2.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.
@@ -11,9 +11,17 @@ module RoleAuthorization
|
|
11
11
|
end
|
12
12
|
|
13
13
|
module InstanceMethods
|
14
|
+
def scope_with(scope)
|
15
|
+
if scope.is_a?(Symbol) || scope.is_a?(String) || scope.is_a?(Integer)
|
16
|
+
scope
|
17
|
+
else
|
18
|
+
scope.id
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
14
22
|
def users(scope = nil)
|
15
23
|
if user_ids.is_a?(Hash)
|
16
|
-
User.where(:id => user_ids[scope])
|
24
|
+
User.where(:id => user_ids[scope_with(scope)])
|
17
25
|
else
|
18
26
|
User.where(:id => user_ids)
|
19
27
|
end
|
@@ -93,7 +93,7 @@ module RoleAuthorization
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
-
if save
|
96
|
+
if save(:validate => false)
|
97
97
|
RoleAuthorization::Roles.manager.klass.find_by_name(role_name).add_user(self.id, scope)
|
98
98
|
true
|
99
99
|
else
|
@@ -121,7 +121,7 @@ module RoleAuthorization
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
if save
|
124
|
+
if save(:validate => false)
|
125
125
|
RoleAuthorization::Roles.manager.klass.find_by_name(role_name).remove_user(self.id, scope)
|
126
126
|
true
|
127
127
|
else
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: role_authorization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- John 'asceth' Long
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-09 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|