i_am_i_can 4.1.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/i_am_i_can/permission/assignment.rb +12 -5
- data/lib/i_am_i_can/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edde7fa4072a2d78c7b5017f9d42e0aab9925f1f
|
4
|
+
data.tar.gz: 99d658e9ce576ed82207f577cfcba96202a6cdfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 195ed325b75c8b7a7b7e94cb6cd601214451044f438f25c26c357187d9cd229ca5c37000cf5ca28b03f95b22964be0f3e7131f4c4cc36926036ccc75d9871d2b
|
7
|
+
data.tar.gz: 96a3122e55433bfb0115051c4da61fd465d9909e4d977fb7a84819d8dd88c310aa87e58ea30397c9bdb2fb71bb27362f4fc5ddfa136f3f8ef5d8dc551a2c37dd
|
@@ -25,11 +25,18 @@ module IAmICan
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def _permissions_assignment(
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
def _permissions_assignment(exec = :assign, actions, obj)
|
29
|
+
if actions.first.is_a?(i_am_i_can.permission_model)
|
30
|
+
exec_arg, names = actions, actions.map(&:name)
|
31
|
+
else
|
32
|
+
objs = obj ? Array(obj) : [nil]
|
33
|
+
permissions = actions.product(objs).map { |(p, o)| { action: p, **deconstruct_obj(o) } }
|
34
|
+
exec_arg = permissions.reduce({ }) { |a, b| a.merge(b) { |_, x, y| [x, y] } }
|
35
|
+
names = permissions.map { |pms| pms.values.compact.join('_').to_sym }
|
36
|
+
end
|
37
|
+
|
38
|
+
assignment = _stored_permissions_exec(exec, exec_arg)
|
39
|
+
ResultOf.permission assignment, i_am_i_can, given: [[], names]
|
33
40
|
end
|
34
41
|
end
|
35
42
|
end
|
data/lib/i_am_i_can/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i_am_i_can
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zhandao
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|