permits 1.1.3 → 1.1.4

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: ea8daf1a2d53e1643da63e45ee64d0a66dfc909df0db26f80c05dba80fe579d7
4
- data.tar.gz: 21456b939a5c0a78ca7db69145af2c242f546eaa8ea9ef9928aedf22ac554591
3
+ metadata.gz: 286b7513dd702adcdea77f7b64ca2bc1ec4fcea9139b395a999d0ad3dce9519e
4
+ data.tar.gz: 3a40c44c1771d333976ff5ab583593f567a67c6e9d67a111253a804b0eacffc0
5
5
  SHA512:
6
- metadata.gz: 1827aff9da6a521a9aa401da4a7fdc028e6d09210a60c771e8299b28ea749dfd7dc615e971ee08f35eff7f4bbfcd01fbab44d7cdb8e25181933124a930fecd67
7
- data.tar.gz: 0b43fff3a7126319af86572ec8e0c8fc1b29304e5cd43d8903fc0ecdd8215ead6ee0a679e02e2edde5f7a4bb8739331b174b904d7eae5546b23c7debf9aa2616
6
+ metadata.gz: 99e7744eb958b9ff8f79b20ea7548cf3617996a2cb3b174346b4e3ca07982c60d76433943d7a94fc9d7f9af0dcd77e7e01e99e98817f416a882ba9e05fffe5e0
7
+ data.tar.gz: 5f8678cebb7e92cb2ec6553e67751d208e6f2e638aeecbfb6e7f4bede0d360efe883ba19eebc908b8ae6be06899dcbe551cd9a0ba6b8cddfb602e17165351849
@@ -35,14 +35,18 @@ module Permits
35
35
  end
36
36
  end
37
37
 
38
- private
39
-
40
- def has_action_permissions?(action, for_resource: resource)
38
+ def has_action_permissions?(action, for_resource: resource, for_resource_type: nil, for_resource_id: nil)
41
39
  return false unless owner_permissions.respond_to?("permits_#{action}")
42
40
 
43
- owner_permissions.send("permits_#{action}").where(resource: for_resource).exists?
41
+ if for_resource_type && for_resource_id
42
+ owner_permissions.send("permits_#{action}").where(resource_type: for_resource_type, resource_id: for_resource_id).exists?
43
+ else
44
+ owner_permissions.send("permits_#{action}").where(resource: for_resource).exists?
45
+ end
44
46
  end
45
47
 
48
+ private
49
+
46
50
  def owner_permissions
47
51
  @owner_permissions ||= ::Permits::Permission.active.where(owner: owner).includes(:resource)
48
52
  end
@@ -1,3 +1,3 @@
1
1
  module Permits
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: permits
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Gilchrist
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-06 00:00:00.000000000 Z
11
+ date: 2024-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aasm
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  - !ruby/object:Gem::Version
184
184
  version: '0'
185
185
  requirements: []
186
- rubygems_version: 3.5.10
186
+ rubygems_version: 3.5.15
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: A User and Role management gem for Rails 7