atlas_rb 1.15.0 → 1.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/CHANGELOG.md +31 -0
- data/Gemfile.lock +1 -1
- data/lib/atlas_rb/resource.rb +18 -7
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7c13a532b6294a91f70d7741ddda78b489f0b0ef9125f9276cd10618ad1119cd
|
|
4
|
+
data.tar.gz: cff5b9e17d774c251b986baea4507afb497c5b744f7d985e20f4f1e1cd6c5396
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92b30a85e8b1870693c3ec5df6e5b33faf285de1c4b05df4dac7f6c124be1250cfbb5f6bbb066de3fdb01c70420b376b46eb265a2dd8104b1198f4d326c958a3
|
|
7
|
+
data.tar.gz: 3cf3ae964a6c47e958bf6ca294a9b672ba0dcf5eede7f645c3ea7498fb264c2ad5b6e42e6ee96519e4360fccb280d02d485db9d92df64c07b8aa59a3d5760e63
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.15.
|
|
1
|
+
1.15.1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.15.1
|
|
4
|
+
|
|
5
|
+
### Fixed — `Resource.permissions` no longer coerces a refused read to `nil`
|
|
6
|
+
|
|
7
|
+
Atlas gates `GET /resources/:id/permissions` on the caller's read right over
|
|
8
|
+
the resource itself, because the envelope names the Grouper groups and the
|
|
9
|
+
depositor's NUID. A caller who may not read the resource gets a real `403`
|
|
10
|
+
carrying `{ "error", "action", "subject" }`.
|
|
11
|
+
|
|
12
|
+
The binding parsed that body without consulting the status. The error envelope
|
|
13
|
+
has no `"resource"` key, so `JSON.parse(body)["resource"]` returned the same
|
|
14
|
+
`nil` an unknown id returns — the status, the message and the distinction were
|
|
15
|
+
all gone before the caller saw anything. A host reading this to drive its own
|
|
16
|
+
gate rendered "not found" for a resource the reader was merely not allowed to
|
|
17
|
+
see.
|
|
18
|
+
|
|
19
|
+
`permissions` now routes through `fetch_resource`, the guarded read path every
|
|
20
|
+
typed `find` already uses:
|
|
21
|
+
|
|
22
|
+
| Atlas answers | `permissions` |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `200` | the ACL `Mash` |
|
|
25
|
+
| `404` | `nil` — unchanged |
|
|
26
|
+
| `403` | raises `AtlasRb::ResourceError`, `status == 403` |
|
|
27
|
+
|
|
28
|
+
A host that wants the old "nil for anything unreadable" behaviour rescues
|
|
29
|
+
`AtlasRb::ResourceError` and returns `nil` itself.
|
|
30
|
+
|
|
31
|
+
The YARD example was also wrong: the envelope carries `type`, `depositor`,
|
|
32
|
+
`proxy_uploader`, `edit_users`, `read`, `edit` and `embargo`, never `id`.
|
|
33
|
+
|
|
3
34
|
## 1.15.0
|
|
4
35
|
|
|
5
36
|
### Changed — the transport reuses connections instead of opening one per request
|
data/Gemfile.lock
CHANGED
data/lib/atlas_rb/resource.rb
CHANGED
|
@@ -159,6 +159,13 @@ module AtlasRb
|
|
|
159
159
|
|
|
160
160
|
# Fetch the access-control entries for a resource.
|
|
161
161
|
#
|
|
162
|
+
# Routed through {fetch_resource} so a refusal stays a refusal. Atlas gates
|
|
163
|
+
# this endpoint on the caller's read right over the resource itself and
|
|
164
|
+
# answers `403` with an `{ "error", "action", "subject" }` envelope, which
|
|
165
|
+
# has no `"resource"` key — parsing it directly would hand back the same
|
|
166
|
+
# `nil` an unknown id gives, and a caller cannot tell "may not see it" from
|
|
167
|
+
# "is not there".
|
|
168
|
+
#
|
|
162
169
|
# @param id [String] an Atlas resource ID.
|
|
163
170
|
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
164
171
|
# path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
|
|
@@ -166,17 +173,21 @@ module AtlasRb
|
|
|
166
173
|
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
167
174
|
# header. Falls through to {AtlasRb.config}.default_on_behalf_of when
|
|
168
175
|
# omitted.
|
|
169
|
-
# @return [
|
|
170
|
-
# typically containing read/write/admin
|
|
176
|
+
# @return [AtlasRb::Mash, nil] the `"resource"` payload from
|
|
177
|
+
# `GET /resources/<id>/permissions`, typically containing read/write/admin
|
|
178
|
+
# grant lists; `nil` when Atlas reports the resource is absent (`404`).
|
|
179
|
+
# @raise [AtlasRb::ResourceError] on any other non-2xx — notably `403`,
|
|
180
|
+
# carrying `status` so the caller can render its own forbidden page.
|
|
171
181
|
#
|
|
172
182
|
# @example
|
|
173
183
|
# AtlasRb::Resource.permissions("abc123")
|
|
174
|
-
# # => { "
|
|
184
|
+
# # => { "type" => "Work", "depositor" => "001234567",
|
|
185
|
+
# # "read" => [...], "edit" => [...], "edit_users" => [...] }
|
|
175
186
|
def self.permissions(id, nuid: nil, on_behalf_of: nil)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
)
|
|
187
|
+
result = fetch_resource('/resources/' + id + '/permissions', nuid: nuid, on_behalf_of: on_behalf_of)
|
|
188
|
+
return nil if result.nil?
|
|
189
|
+
|
|
190
|
+
AtlasRb::Mash.new(result)["resource"]
|
|
180
191
|
end
|
|
181
192
|
|
|
182
193
|
# Fetch the audit-event history for a resource.
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: atlas_rb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.15.
|
|
4
|
+
version: 1.15.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Cliff
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|