checken 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/checken/extensions/action_controller.rb +5 -4
- data/lib/checken/permission.rb +1 -1
- data/lib/checken/permission_group.rb +1 -1
- data/lib/checken/schema.rb +7 -0
- data/lib/checken/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 136b7129a73d4d87eeee9f73edde72db1be22457a828e2c3cad94a88ecb7f0a9
|
4
|
+
data.tar.gz: 20069b119a49574d80f8a0db1d55ca5fba6d00903e397a71b7ecc54aac44e762
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e2d93519751eff404c72e9ec1ccab7b5a5aef99db3803bd59874e7975c254d96cb1680b4ff65681754b737e6c4abc083edf064e58d477ba6a0c5b4acdb042e8
|
7
|
+
data.tar.gz: 4a4b30492281eaab15a22ce019688aae46229fb8c94c4c4703b717a2f04cf8646afc3f2da4f35505ca9f3a410d76ad0cfb752abee7abb71fc1b771f37948cde7
|
@@ -17,13 +17,14 @@ module Checken
|
|
17
17
|
# when performing permission checks using `restrict`.
|
18
18
|
end
|
19
19
|
|
20
|
-
def restrict(permission_path, object = nil, options = {}
|
20
|
+
def restrict(permission_path, object = nil, options = {})
|
21
21
|
if checken_user_proxy.nil?
|
22
22
|
user = send(Checken.current_schema.config.current_user_method_name)
|
23
23
|
user_proxy = Checken.current_schema.config.user_proxy_class.new(user)
|
24
24
|
else
|
25
25
|
user_proxy = checken_user_proxy
|
26
26
|
end
|
27
|
+
strict = options.delete(:strict) { true }
|
27
28
|
granted_permissions = Checken.current_schema.check_permission!(permission_path, user_proxy, object, strict: strict)
|
28
29
|
granted_permissions.each do |permission|
|
29
30
|
granted_checken_permissions << permission
|
@@ -44,8 +45,8 @@ module Checken
|
|
44
45
|
options = options_if_object_provided
|
45
46
|
end
|
46
47
|
|
47
|
-
|
48
|
-
restrict_options = options.delete(:
|
48
|
+
restrict_options = options.delete(:restrict_options) || {}
|
49
|
+
restrict_options[:strict] = options.delete(:strict) { true }
|
49
50
|
|
50
51
|
before_action(options) do
|
51
52
|
if object.is_a?(Proc)
|
@@ -62,7 +63,7 @@ module Checken
|
|
62
63
|
resolved_object = nil
|
63
64
|
end
|
64
65
|
|
65
|
-
restrict(permission_path, resolved_object, restrict_options
|
66
|
+
restrict(permission_path, resolved_object, restrict_options)
|
66
67
|
end
|
67
68
|
|
68
69
|
end
|
data/lib/checken/permission.rb
CHANGED
data/lib/checken/schema.rb
CHANGED
@@ -25,6 +25,7 @@ module Checken
|
|
25
25
|
# Add configuration for this schema
|
26
26
|
def configure(&block)
|
27
27
|
block.call(@config)
|
28
|
+
set_namespace if @config.namespace
|
28
29
|
end
|
29
30
|
|
30
31
|
# Does the given user have the appropriate permissions to handle?
|
@@ -169,5 +170,11 @@ module Checken
|
|
169
170
|
raise error
|
170
171
|
end
|
171
172
|
|
173
|
+
def set_namespace
|
174
|
+
@schema.transform_keys! do |key|
|
175
|
+
"#{@config.namespace}#{@config.namespace_delimiter}#{key}"
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
172
179
|
end
|
173
180
|
end
|
data/lib/checken/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: checken
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An authorization framework for Ruby & Rails applications.
|
14
14
|
email:
|