permissable 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/permissable/member.rb +1 -1
- data/lib/permissable/permission.rb +6 -5
- data/permissable.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/permissable/member.rb
CHANGED
@@ -45,7 +45,7 @@ module Permissable
|
|
45
45
|
|
46
46
|
def cannot!(methods, resources)
|
47
47
|
methods = [methods].flatten.uniq
|
48
|
-
existing = permissions.for_resource(resource).with_permission_to(methods).all.collect{ |perm| perm.id }
|
48
|
+
existing = permissions.for_resource(resource).with_permission_to(methods).all.collect{ |perm| perm.id }.uniq
|
49
49
|
Permission.destroy(existing)
|
50
50
|
end
|
51
51
|
|
@@ -21,11 +21,12 @@ class Permission < ActiveRecord::Base
|
|
21
21
|
perm = perm.is_a?(Array) ? perm.collect{ |p| p.to_s } : perm.to_s
|
22
22
|
where(:permission_type => perm)
|
23
23
|
end
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
|
25
|
+
def flatten(obj)
|
26
|
+
return { :ids => obj, :types => obj.class.to_s } unless obj.is_a?(Array)
|
27
|
+
{ :ids => obj.collect{ |o| o.id }, :types => obj.collect{ |o| o.class.to_s } }
|
28
|
+
end
|
29
|
+
|
29
30
|
end
|
30
31
|
|
31
32
|
end
|
data/permissable.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: permissable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brent Kirby
|