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 +4 -4
- data/lib/permits/policy/base.rb +8 -4
- data/lib/permits/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 286b7513dd702adcdea77f7b64ca2bc1ec4fcea9139b395a999d0ad3dce9519e
|
4
|
+
data.tar.gz: 3a40c44c1771d333976ff5ab583593f567a67c6e9d67a111253a804b0eacffc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99e7744eb958b9ff8f79b20ea7548cf3617996a2cb3b174346b4e3ca07982c60d76433943d7a94fc9d7f9af0dcd77e7e01e99e98817f416a882ba9e05fffe5e0
|
7
|
+
data.tar.gz: 5f8678cebb7e92cb2ec6553e67751d208e6f2e638aeecbfb6e7f4bede0d360efe883ba19eebc908b8ae6be06899dcbe551cd9a0ba6b8cddfb602e17165351849
|
data/lib/permits/policy/base.rb
CHANGED
@@ -35,14 +35,18 @@ module Permits
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
|
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
|
-
|
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
|
data/lib/permits/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|