cancan-export 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87e2dbeeaf098018c03fcf91e740c1ee83f5840e
|
4
|
+
data.tar.gz: 0a533b49331d5e44c929f57872ec240b5585501f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91b9813bf3e091f9d609040e885994c9b18492883cc57ed792248cfa455539cd79ab7384d9c0d33777ef89647b90b862d8deec3cb37a6561a72db6ce3823d63c
|
7
|
+
data.tar.gz: e4d954ddf61ba271e830daf8d5b3fc9db57bd89d4e6b21b98efdef53ff2936dfc037d5a8bf7b428ff185d11b2e904fd8dcbb42b93152b69244bda6fa02ef76b7
|
@@ -27,8 +27,8 @@
|
|
27
27
|
|
28
28
|
# @ data : [gon Object]
|
29
29
|
constructor: (data) ->
|
30
|
-
@user = data.user
|
31
30
|
$.extend @, data.ability
|
31
|
+
@[@userProperty or 'user'] = data.user
|
32
32
|
|
33
33
|
# Import each helper defined in ruby's Ability object.
|
34
34
|
# `this' must be the object in which context `user' property is defined, thus it is Ability itself
|
@@ -13,6 +13,10 @@ module CanCan
|
|
13
13
|
}.to_h
|
14
14
|
end
|
15
15
|
|
16
|
+
def user_as(property_name)
|
17
|
+
@user_property = property_name
|
18
|
+
end
|
19
|
+
|
16
20
|
def helper_methods
|
17
21
|
@helpers ||= {}
|
18
22
|
end
|
@@ -25,7 +29,8 @@ module CanCan
|
|
25
29
|
rulesIndex: @rules_index.map {|object, indices|
|
26
30
|
[object.to_s, indices]
|
27
31
|
}.to_h,
|
28
|
-
helpersSource: helper_methods
|
32
|
+
helpersSource: helper_methods,
|
33
|
+
userProperty: @user_property
|
29
34
|
}.to_json(options)
|
30
35
|
end
|
31
36
|
|