checken 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6da20c9c5c377f6900bbaa81ec9bd0ebc8e874324147bb742a8041016486e2d
4
- data.tar.gz: e41b4eed54d9fbfa10163b46e05315e5cea479186548629831544ffc7493b536
3
+ metadata.gz: f09a1b718b9cf32352831821e53cd9c4e33d2c652a1d1cc9dd5dccf1d63061d3
4
+ data.tar.gz: 37c73bd21ba50acf53c0c11aa0d50b094e2dbaef936b2f58b825c6c7aff8224f
5
5
  SHA512:
6
- metadata.gz: b79c4b6803e77bed927201fc92cf02185a9a1cfb98d6e597ed2a2bf2c59d0343557987bd6b419722ac68738f591691a4197d776f84458699bfaf9b779b10c26e
7
- data.tar.gz: a7087a9d2c198704960eeb36480f018de292ffb20d4a41d88fc3cfcc12957e52e5d176a7636ede7ee0019c0b601d7b49a15d9ad6e39e2c9832c859252ead39b0
6
+ metadata.gz: 9a42a47bbbb3157fc6438d93ac1d9f299ebc4155906cac27ec6a2f04c83465bbb645d54a79466dae91225a09c365b03ab9a85f0a11408db6cf8a8b17521300d8
7
+ data.tar.gz: c3b956f87bcd9c238664f917f5e3d6dd599d7f3642a4745c2156c3d672a18bccece877ece1758c64685d36dbca84f2f315f6ba03b5f5e590489d465ae1a6a2b0
@@ -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 = {}, strict: true)
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
- strict = options.delete(:strict) { true }
48
- restrict_options = options.delete(:restrict_options)
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, strict: strict)
66
+ restrict(permission_path, resolved_object, restrict_options)
66
67
  end
67
68
 
68
69
  end
@@ -1,3 +1,3 @@
1
1
  module Checken
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checken
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke