cancancan-system 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -0
- data/app/models/concerns/can_can_can/system/ability.rb +15 -6
- data/lib/cancancan-system/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 253f1db910ec70b137aae617ae0687b1a68d530867f2633a85c9af878b60d2f6
|
4
|
+
data.tar.gz: 60420111c58708ddc8ba58c3062db44f5421e8592475566e925d81259d50d54e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0dc138a86917f2dfcc348372a0968dedb459a56ef01ece0fba04e962f717973fd8cf5dbcd2bcc3ba05b5b56b8c5f8926616dd9d0525bf15647172d1272a3dca
|
7
|
+
data.tar.gz: 7e6873d00dd8618f48bbbcf2b1c6324e18316cc3031ccf9264a744417f8485366384597fa582cceac0d56580145385ab6b928ac29d2224aa5705acdecfe56e3f
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -33,9 +33,9 @@ module CanCanCan
|
|
33
33
|
public_abilities record_class if options[:public_abilities]
|
34
34
|
if user
|
35
35
|
if options[:polymorphic]
|
36
|
-
can :manage, record_class, "#{options[:column]}
|
36
|
+
can :manage, record_class, "#{get_column(options[:column])}": user.id, "#{get_column(options[:column], 'type')}": user.class.name
|
37
37
|
else
|
38
|
-
can :manage, record_class, "#{options[:column]}
|
38
|
+
can :manage, record_class, "#{get_column(options[:column])}": user.id
|
39
39
|
end
|
40
40
|
yield if block_given?
|
41
41
|
end
|
@@ -57,9 +57,9 @@ module CanCanCan
|
|
57
57
|
can ability, record_class, "#{options[:column] || class_name.pluralize}": { id: belonging.belonger_id }
|
58
58
|
else
|
59
59
|
if options[:polymorphic]
|
60
|
-
can ability, record_class, "#{options[:column] || class_name}
|
60
|
+
can ability, record_class, "#{get_column(options[:column] || class_name)}": belonging.belonger_id, "#{get_column(options[:column] || class_name, 'type')}": belonging.belonger_type
|
61
61
|
else
|
62
|
-
can ability, record_class, "#{options[:column] || class_name}
|
62
|
+
can ability, record_class, "#{get_column(options[:column] || class_name)}": belonging.belonger_id
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -69,9 +69,9 @@ module CanCanCan
|
|
69
69
|
can :manage, record_class, "#{options[:column] || class_name.pluralize}": { id: object.id }
|
70
70
|
else
|
71
71
|
if options[:polymorphic]
|
72
|
-
can :manage, record_class, "#{options[:column] || class_name}
|
72
|
+
can :manage, record_class, "#{get_column(options[:column] || class_name)}": object.id, "#{get_column(options[:column] || class_name, 'type')}": object.class.name
|
73
73
|
else
|
74
|
-
can :manage, record_class, "#{options[:column] || class_name}
|
74
|
+
can :manage, record_class, "#{get_column(options[:column] || class_name)}": object.id
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -142,6 +142,15 @@ module CanCanCan
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
+
|
146
|
+
def get_column column, name = 'id'
|
147
|
+
if column.nil? || column == ''
|
148
|
+
name
|
149
|
+
else
|
150
|
+
"#{column}_#{name}"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
145
154
|
end
|
146
155
|
end
|
147
156
|
end
|