permits 1.1.2 → 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: 2a8084521f699b963c38458be09379b8035e951e48097fbbbeaea5b0e8790746
4
- data.tar.gz: 89579b12e89096b0425c93db840061ff86a871ce3ed236aeb73feb9b39e1bd0d
3
+ metadata.gz: 286b7513dd702adcdea77f7b64ca2bc1ec4fcea9139b395a999d0ad3dce9519e
4
+ data.tar.gz: 3a40c44c1771d333976ff5ab583593f567a67c6e9d67a111253a804b0eacffc0
5
5
  SHA512:
6
- metadata.gz: a15d4783b772cc8abc874fefefb50994475f14b739e85ff3bc9a369624423042ffd27016325e115eacf0e1436acb429c815416081d68cc67a085f83411d4116d
7
- data.tar.gz: 2859613c2daa73ec88f534fc47bb8ab6d010e46e9c8b4bb685f92711df04307f5f5c182373ae56946e4e2c7f19101559a7c0761b4d2f1336b8cc050fae4ac49d
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.2"
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.2
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-06-14 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
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: timelines
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.3.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.3.0
55
55
  - !ruby/object:Gem::Dependency
@@ -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