credential_authorization 0.1.2 → 0.1.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
  SHA256:
3
- metadata.gz: e611cf138160c85aa3d68f36982817acea227a81b02773043e81c5d8db940283
4
- data.tar.gz: 386e60fad08733a2350d61a431db40b78dc2bf622ab6a0dcf21799c34301b114
3
+ metadata.gz: db045c130d449eb4a7a483313b39d085f3a56f9d274a2a7a7a18c4f92bacd516
4
+ data.tar.gz: 89a302c955acf1abfb4edb4f225574f5eb8fbadde36dae79dd90b3b585e13fbf
5
5
  SHA512:
6
- metadata.gz: d4e5ef6a4c7a2d955e675576b2f993b66ce3523987ca8bf10ffd800309812de9cff3b44bfac6cb64bcc3d768d510e1a1452db821bf9820d7b3aa6a1ad6515910
7
- data.tar.gz: 4aa4cb342c75afb0b1f55aae7e32a42679b93cec653e76d5787d85f480ad0f4ee363badf64078ad86928ef72e31babb57eeeadd563e794f49a19d3f793c6b7aa
6
+ metadata.gz: 8864fc536fde23d3ce1ac8af5dfdd8fcec220dd104b5ade58917de6f4a102e4eb8b295fa52b6c42d65e96c6b80b2d2cc3ce5b10e92bbdf822f4c99cd913db08e
7
+ data.tar.gz: cc39097a084defc0a21f875d2b87753caebff90deb798fde426b82546d679b53a2482d83545d31a2269ec49cd0208001e99aa9e0dee1e2601ab979659dacd9cd
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CredentialAuthorization
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -12,27 +12,27 @@ module CredentialAuthorization
12
12
  yield self
13
13
  end
14
14
 
15
- def self.can?(permission)
16
- found = self.find_permission(permission)
15
+ def self.can?(record:, permission:)
16
+ found = self.find_permission(self.build_permission_key(record:, permission:))
17
17
 
18
18
  yield if block_given? && found
19
19
  found
20
20
  end
21
21
 
22
- def self.can!(permission, &block)
23
- raise CredentialAuthorization::InsufficientPermission.new(permission) unless self.can?(permission, &block)
22
+ def self.can!(record:, permission:, &block)
23
+ raise CredentialAuthorization::InsufficientPermission.new(permission) unless self.can?(record:, permission:, &block)
24
24
  true
25
25
  end
26
26
 
27
- def self.cannot?(permission)
28
- found = self.find_permission(permission)
27
+ def self.cannot?(record:, permission:)
28
+ found = self.find_permission(self.build_permission_key(record:, permission:))
29
29
 
30
30
  yield if block_given? && !found
31
31
  !found
32
32
  end
33
33
 
34
- def self.cannot!(permission, &block)
35
- raise CredentialAuthorization::SufficientPermission.new(permission) unless self.cannot?(permission, &block)
34
+ def self.cannot!(record:, permission:, &block)
35
+ raise CredentialAuthorization::SufficientPermission.new(permission) unless self.cannot?(record:, permission:, &block)
36
36
  true
37
37
  end
38
38
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credential_authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - JoelGamer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-01 00:00:00.000000000 Z
11
+ date: 2024-10-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: