cancancan_nested_auth 0.0.1 → 1.0.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfb4fbb1dfb77fefb8093c8b34cb03cc7014981a3b15a8c83e8574a9c3aeeb3a
|
4
|
+
data.tar.gz: ad181c3e808686f022518523a0857804ec9127868a61013051dd14b623b44dee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2144f3da1801f95bcc25b9b23a933cb5ba542abcb89049557d99c8b7c66fbed9c1add45ce2b4009657cb22b1792d56cd5c57ddbba69cb3528610c560b8b7e43b
|
7
|
+
data.tar.gz: 3803d9b0298714e3f086e2f1d5481f793f1e8e13a08d5a0e3a0311091f70ab45c38b3ec0adc82edcff16570999c00337462ae33cd0ab9e9b0d07e6c92ace9962
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module CanCanCan
|
2
2
|
module NestedAssignmentAndAuthorization
|
3
3
|
class Configuration
|
4
|
-
attr_accessor :silence_raised_errors, :use_smart_nested_authorizations
|
4
|
+
attr_accessor :silence_raised_errors, :use_smart_nested_authorizations, :use_resource_key_in_params
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
# Allows for stopping unauthorized actions without raising errors
|
@@ -9,6 +9,11 @@ module CanCanCan
|
|
9
9
|
# Auto-determine what action to auth on nested associations (:create, :update, :destroy)
|
10
10
|
# - will use the action of the root object otherwise.
|
11
11
|
@use_smart_nested_authorizations = true
|
12
|
+
# Set to `true` if you're nesting parameter data under the resource_key
|
13
|
+
# - i.e. params => {user: {email: 'test', name: 'fun'}}
|
14
|
+
# Set to `false` if resource parameter data is direct in in params.
|
15
|
+
# - i.e. params => {email: 'test', name: 'fun'}
|
16
|
+
@use_resource_key_in_params = true
|
12
17
|
end
|
13
18
|
end
|
14
19
|
end
|
@@ -16,6 +16,9 @@ module CanCanCan
|
|
16
16
|
@ability = current_ability
|
17
17
|
@parent_object = parent_object
|
18
18
|
@params = params
|
19
|
+
if CanCanCan::NestedAssignmentAndAuthorization.configuration.use_resource_key_in_params
|
20
|
+
@params = @params[parent_object.model_name.singular.to_sym]
|
21
|
+
end
|
19
22
|
if @params.kind_of?(ActionController::Parameters)
|
20
23
|
@params = @params.permit!.to_h
|
21
24
|
end
|
data/lib/cancancan/version.rb
CHANGED