apiphobic-authorization 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/apiphobic/authorization/resource.rb +17 -9
- data/lib/apiphobic/authorization/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c135e4a79e3b2097aa987b0916813ab570e8125068e85de6e7344551fa1002e5
|
4
|
+
data.tar.gz: a08e93dea792d5a558858311162fd3481f6cdfb770b85cd1aefc2880975258ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 321a53341b56b78dc15dd41e8e3dd5ad8ac56ac95421e0adb274bfdfbe284b97ca4b0d0974cefce58cdaa11208641c4c4cf641c06c6afb6115fe6096488d5b40
|
7
|
+
data.tar.gz: f11fc3cc8c28a7367607ef6c357a0a71951704fd89382314085daa2256e30d8a6aa696fbdf16517b030a6d3a321c0c590ac5f72754da72ec41c2c635dec1e384
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -20,6 +20,10 @@ module Resource
|
|
20
20
|
Object.const_get(authorizer_class_name('Parameters'))
|
21
21
|
end
|
22
22
|
|
23
|
+
def authorized_resource_class
|
24
|
+
Object.const_get(authorized_resource_class_name)
|
25
|
+
end
|
26
|
+
|
23
27
|
def authorizer_scope_class
|
24
28
|
@authorizer_scope_class ||= Object.const_get(authorizer_class_name('Scope'))
|
25
29
|
end
|
@@ -36,12 +40,17 @@ module Resource
|
|
36
40
|
base_resource_name,
|
37
41
|
type,
|
38
42
|
]
|
39
|
-
.
|
43
|
+
.map(&:to_s)
|
44
|
+
.reject(&:empty?)
|
40
45
|
end
|
41
46
|
|
42
47
|
def authorizer_class_name(type = nil)
|
43
48
|
authorizer_class_components(type).join('::')
|
44
49
|
end
|
50
|
+
|
51
|
+
def authorized_resource_class_name
|
52
|
+
singular_resource_class_name
|
53
|
+
end
|
45
54
|
end
|
46
55
|
|
47
56
|
def self.included(base)
|
@@ -59,7 +68,7 @@ module Resource
|
|
59
68
|
Erratum.fail(
|
60
69
|
'Forbidden',
|
61
70
|
resource_name: self.class.singular_underscored_base_resource_name,
|
62
|
-
resource_id: [
|
71
|
+
resource_id: [authorized_resource_identifier],
|
63
72
|
action: action_name,
|
64
73
|
)
|
65
74
|
end
|
@@ -111,21 +120,20 @@ module Resource
|
|
111
120
|
token: token)
|
112
121
|
end
|
113
122
|
|
114
|
-
def authorized_resource_class
|
115
|
-
@authorized_resource_class ||= Object
|
116
|
-
.const_get(self.class.singular_resource_class_name)
|
117
|
-
end
|
118
|
-
|
119
123
|
def authorized_resource
|
120
124
|
return if RESOURCE_COLLECTION_ACTIONS.include?(action_name)
|
121
125
|
|
122
126
|
@authorized_resource ||= \
|
123
127
|
::Apiphobic::Resource::Model
|
124
|
-
.new(resource: authorized_resource_class,
|
125
|
-
id:
|
128
|
+
.new(resource: self.class.authorized_resource_class,
|
129
|
+
id: authorized_resource_identifier,
|
126
130
|
parameters: authorized_parameters)
|
127
131
|
end
|
128
132
|
|
133
|
+
def authorized_resource_identifier
|
134
|
+
params[:id]
|
135
|
+
end
|
136
|
+
|
129
137
|
def authorized_collection
|
130
138
|
return unless RESOURCE_COLLECTION_ACTIONS.include?(action_name)
|
131
139
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apiphobic-authorization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thegranddesign
|
@@ -37,7 +37,7 @@ cert_chain:
|
|
37
37
|
3yXL4G6eW3rdBW/OiLF7GgG2o26d02OMzf4+ubUVS5LQDOcd4vgNPLWzJSBt1YIh
|
38
38
|
TgBsED7Me5YdMVXxtTWYsF1VMzaL9hReD3UXGcxe
|
39
39
|
-----END CERTIFICATE-----
|
40
|
-
date: 2022-
|
40
|
+
date: 2022-08-01 00:00:00.000000000 Z
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: apiphobic-resource
|
@@ -165,7 +165,7 @@ metadata:
|
|
165
165
|
allowed_push_host: https://rubygems.org
|
166
166
|
bug_tracker_uri: https://github.com/thekompanee/apiphobic-authorization/issues
|
167
167
|
changelog_uri: https://github.com/thekompanee/apiphobic-authorization/blob/master/CHANGELOG.md
|
168
|
-
documentation_uri: https://github.com/thekompanee/apiphobic-authorization/tree/releases/v1.7.
|
168
|
+
documentation_uri: https://github.com/thekompanee/apiphobic-authorization/tree/releases/v1.7.1
|
169
169
|
homepage_uri: https://github.com/thekompanee/apiphobic-authorization
|
170
170
|
source_code_uri: https://github.com/thekompanee/apiphobic-authorization
|
171
171
|
wiki_uri: https://github.com/thekompanee/apiphobic-authorization/wiki
|
metadata.gz.sig
CHANGED
Binary file
|