atlas_rb 1.23.0 → 1.25.0
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 +51 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/atlas_rb/person.rb +39 -5
- data/lib/atlas_rb/resource_writes.rb +11 -2
- data/lib/atlas_rb/user.rb +15 -10
- 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: 2274a10469db90f642ca79a877ab37f9db69c294c55737a28824885249ef6220
|
|
4
|
+
data.tar.gz: c16a9865aa30a521823c17587e80179e681fab4a9c3747957ab0b943e8591548
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fbf77b86e3b695401be85f2f913d4c71820ae2e1c2078884d6b13038d46cca749aaafaf7ef588e9f742db01e8b53b5375734893572430a9ccc7adbfed5444e50
|
|
7
|
+
data.tar.gz: baf502af151908b4da14e4e51597d60f7c88b90d7659deac2731bd44dc317376dce11bbb8e2c2e9f3d7fbfc33adc0e8b6572124769651e7917bfb51eaaac76b5
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.25.0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.25.0
|
|
4
|
+
|
|
5
|
+
These bindings need Atlas 0.6.214 or later.
|
|
6
|
+
|
|
7
|
+
### Added — `q:` on `Person.list`, and `Person.page`
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
AtlasRb::Person.list(q: "gasp", nuid: admin_nuid)
|
|
11
|
+
result = AtlasRb::Person.page(q: "doe", page: 2, per_page: 50, nuid: admin_nuid)
|
|
12
|
+
result.pagination["count"] # => matches across every page
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`q:` searches the People registry. Atlas returns the Persons whose
|
|
16
|
+
`display_name` contains the fragment, whose NUID starts with it, or whose
|
|
17
|
+
account email contains it, all case-insensitive and ordered by `display_name`.
|
|
18
|
+
The search is admin-only. Anyone else gets a `403`, which raises
|
|
19
|
+
`ResourceError`.
|
|
20
|
+
|
|
21
|
+
`Person.page` takes the same arguments as `Person.list` and returns
|
|
22
|
+
`{ "people" => [...], "pagination" => {...} }`, so a caller can show a page
|
|
23
|
+
count and a total. With `q:`, the block counts the matches. `Person.list`
|
|
24
|
+
still returns the rows alone.
|
|
25
|
+
|
|
26
|
+
### Documented — `display_name` on the user directory
|
|
27
|
+
|
|
28
|
+
`User.search`, `User.resolve` and `User.find_by_nuid` entries now carry
|
|
29
|
+
`display_name`: the librarian-curated Person name for the NUID, or `nil` when
|
|
30
|
+
there is no Person. `User.search` also matches on it, and Atlas orders entries
|
|
31
|
+
by `display_name` when set, else `name`. No code changed: the gem already
|
|
32
|
+
passes the whole entry through.
|
|
33
|
+
|
|
34
|
+
## 1.24.0
|
|
35
|
+
|
|
36
|
+
These bindings need Atlas 0.6.213 or later.
|
|
37
|
+
|
|
38
|
+
### Added — `reason:` on `Resource.tombstone`
|
|
39
|
+
|
|
40
|
+
```ruby
|
|
41
|
+
AtlasRb::Resource.tombstone(work_id, reason: "Removed from view by legal order", nuid: admin_nuid)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The library's withdrawal policy requires a note saying why an object was
|
|
45
|
+
removed, and fixes its wording. `reason:` must be one of the policy's five
|
|
46
|
+
notes, word for word. Atlas answers `422` with `invalid_reason` for any other
|
|
47
|
+
value, and the call returns that raw response as before. The note carries no
|
|
48
|
+
date: read `tombstoned_at` for that.
|
|
49
|
+
|
|
50
|
+
Community, Collection, Work and FileSet reads return the note as
|
|
51
|
+
`tombstone_reason`, including the `410` body of a tombstoned read. A restore
|
|
52
|
+
clears it. Omit the keyword to tombstone with no note, as before.
|
|
53
|
+
|
|
3
54
|
## 1.23.0
|
|
4
55
|
|
|
5
56
|
These bindings need Atlas 0.6.212 or later.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -543,7 +543,7 @@ write. The whole surface:
|
|
|
543
543
|
| `Resource.set_permissions(id, acl)` | `PATCH /resources/{id}/permissions` |
|
|
544
544
|
| `Resource.set_thumbnails(id, thumbnail:, thumbnail_2x:, preview:)` | `PATCH /resources/{id}/thumbnails` |
|
|
545
545
|
| `Resource.reparent(id, parent_id)` | `PATCH /resources/{id}/parent` |
|
|
546
|
-
| `Resource.tombstone(id)` | `POST /resources/{id}/tombstone` |
|
|
546
|
+
| `Resource.tombstone(id, reason:)` | `POST /resources/{id}/tombstone` |
|
|
547
547
|
| `Admin::Resource.restore(id)` | `POST /resources/{id}/restore` |
|
|
548
548
|
| `Admin::Resource.destroy(id, confirm: :i_understand)` | `DELETE /resources/{id}` |
|
|
549
549
|
|
data/lib/atlas_rb/person.rb
CHANGED
|
@@ -20,8 +20,8 @@ module AtlasRb
|
|
|
20
20
|
# keep their usual gem meaning (the acting principal). NUID stays the key only
|
|
21
21
|
# for {.create} (one Person per NUID — and there `nuid:` is the *new person's*
|
|
22
22
|
# NUID, acting principal coming from the ambient `AtlasRb.config.default_nuid`)
|
|
23
|
-
# and {.resolve} (the server-side name-resolution batch). {.list}
|
|
24
|
-
# NOID-keyed People-index source.
|
|
23
|
+
# and {.resolve} (the server-side name-resolution batch). {.list} and
|
|
24
|
+
# {.page} are the NOID-keyed People-index source.
|
|
25
25
|
#
|
|
26
26
|
# Create / update / affiliation writes are :system + admin on the server; a
|
|
27
27
|
# non-privileged caller gets a 403.
|
|
@@ -50,6 +50,14 @@ module AtlasRb
|
|
|
50
50
|
# through atlas_rb without
|
|
51
51
|
# routing People through the catalog/Solr or exposing a NUID publicly.
|
|
52
52
|
#
|
|
53
|
+
# Pass `q:` to search: Atlas returns the Persons whose `display_name`
|
|
54
|
+
# contains the fragment, whose NUID starts with it, or whose account email
|
|
55
|
+
# contains it, all case-insensitive and ordered by `display_name`. The
|
|
56
|
+
# search is admin-only; anyone else gets a `403`. Use {.page} for the
|
|
57
|
+
# match count.
|
|
58
|
+
#
|
|
59
|
+
# @param q [String, nil] typeahead fragment (admin only). Blank lists
|
|
60
|
+
# everyone.
|
|
53
61
|
# @param page [Integer, nil] 1-based page (server default when nil).
|
|
54
62
|
# @param per_page [Integer, nil] page size (server default when nil; capped
|
|
55
63
|
# server-side).
|
|
@@ -62,10 +70,36 @@ module AtlasRb
|
|
|
62
70
|
# @raise [AtlasRb::ResourceError] on any non-2xx other than `404` / `410`
|
|
63
71
|
# (an auth or validation envelope, a `5xx`, a proxy's `503`), carrying
|
|
64
72
|
# Atlas's status and body so the failure is attributable at the boundary.
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
# @example Admin typeahead
|
|
74
|
+
# AtlasRb::Person.list(q: "gasp", nuid: admin_nuid)
|
|
75
|
+
def self.list(q: nil, page: nil, per_page: nil, nuid: nil, on_behalf_of: nil)
|
|
76
|
+
self.page(q: q, page: page, per_page: per_page, nuid: nuid, on_behalf_of: on_behalf_of)&.people
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# One page of the People index with its pagination block — {.list} with
|
|
80
|
+
# the counts kept, for a consumer that shows "page 2 of 7" or a total.
|
|
81
|
+
# With `q:`, the block counts the matches, not the whole registry.
|
|
82
|
+
#
|
|
83
|
+
# @param q [String, nil] typeahead fragment (admin only), as on {.list}.
|
|
84
|
+
# @param page [Integer, nil] 1-based page (server default when nil).
|
|
85
|
+
# @param per_page [Integer, nil] page size (server default when nil; capped
|
|
86
|
+
# server-side).
|
|
87
|
+
# @param nuid [String, nil] acting principal.
|
|
88
|
+
# @param on_behalf_of [String, nil] acting-as target.
|
|
89
|
+
# @return [AtlasRb::Mash, nil] `{ "people" => [...], "pagination" => {...} }`,
|
|
90
|
+
# each `"people"` entry in the {.list} row shape.
|
|
91
|
+
# `nil` when Atlas answers `404` — nothing is there to read, or, with a
|
|
92
|
+
# misconfigured `ATLAS_URL`, the route is not Atlas's at all.
|
|
93
|
+
# @raise [AtlasRb::ResourceError] on any non-2xx other than `404` / `410`
|
|
94
|
+
# (an auth or validation envelope, a `5xx`, a proxy's `503`), carrying
|
|
95
|
+
# Atlas's status and body so the failure is attributable at the boundary.
|
|
96
|
+
# @example
|
|
97
|
+
# result = AtlasRb::Person.page(q: "doe", page: 2, per_page: 50, nuid: admin_nuid)
|
|
98
|
+
# result.pagination["count"] # => matches across every page (Hash#count shadows .count)
|
|
99
|
+
def self.page(q: nil, page: nil, per_page: nil, nuid: nil, on_behalf_of: nil)
|
|
100
|
+
params = { q: q, page: page, per_page: per_page }.compact
|
|
67
101
|
read_body(connection(params, nuid, on_behalf_of: on_behalf_of).get(ROUTE)) do |body|
|
|
68
|
-
|
|
102
|
+
AtlasRb::Mash.new(body)
|
|
69
103
|
end
|
|
70
104
|
end
|
|
71
105
|
|
|
@@ -144,14 +144,23 @@ module AtlasRb
|
|
|
144
144
|
# {Work.file_sets}. Atlas refuses a FileSet from anyone outside the admin and
|
|
145
145
|
# devolved-admin tiers with `403`, even a user who can edit the Work.
|
|
146
146
|
#
|
|
147
|
+
# `reason:` records why the resource was removed (Atlas 0.6.213 or later).
|
|
148
|
+
# It must be one of the removal notes the library's withdrawal policy
|
|
149
|
+
# allows, word for word; Atlas answers `422` with `invalid_reason` for any
|
|
150
|
+
# other value. The note carries no date: read `tombstoned_at` for that.
|
|
151
|
+
# The resource returns it as `tombstone_reason`, and a restore clears it.
|
|
152
|
+
#
|
|
147
153
|
# @param id [String] the resource's NOID.
|
|
154
|
+
# @param reason [String, nil] one of the policy's removal notes, or `nil`
|
|
155
|
+
# for none.
|
|
148
156
|
# @param nuid [String, nil] the acting user's NUID, stamped on the resource
|
|
149
157
|
# as `tombstoned_by`.
|
|
150
158
|
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
151
159
|
# header.
|
|
152
160
|
# @return [Faraday::Response] the raw response — read `status` yourself.
|
|
153
|
-
def self.tombstone(id, nuid: nil, on_behalf_of: nil)
|
|
154
|
-
connection({}, nuid, on_behalf_of: on_behalf_of)
|
|
161
|
+
def self.tombstone(id, reason: nil, nuid: nil, on_behalf_of: nil)
|
|
162
|
+
connection({}, nuid, on_behalf_of: on_behalf_of)
|
|
163
|
+
.post('/resources/' + id + '/tombstone', { reason: reason }.compact.to_json)
|
|
155
164
|
end
|
|
156
165
|
|
|
157
166
|
# Atlas answers a write with the resource under its type key, matching what
|
data/lib/atlas_rb/user.rb
CHANGED
|
@@ -14,7 +14,9 @@ module AtlasRb
|
|
|
14
14
|
# logged-in-user capabilities.
|
|
15
15
|
#
|
|
16
16
|
# The directory lookups enforce minimal disclosure: every entry carries
|
|
17
|
-
# `nuid`
|
|
17
|
+
# `nuid`, `name` and `display_name` only (no email, role, or groups). `name`
|
|
18
|
+
# is the SSO-fed account name; `display_name` is the librarian-curated Person
|
|
19
|
+
# name for that NUID, or `nil` when the NUID has no Person. Rows with role
|
|
18
20
|
# `anonymous`, `guest`, or `system` are never returned. The account methods
|
|
19
21
|
# ({.accounts} / {.set_preferred}) *do* disclose email/groups/affiliation, so
|
|
20
22
|
# Atlas limits them to the person themselves (matching NUID), an admin, or the
|
|
@@ -30,16 +32,18 @@ module AtlasRb
|
|
|
30
32
|
|
|
31
33
|
# Typeahead search of the user directory.
|
|
32
34
|
#
|
|
33
|
-
# Case-insensitive match on
|
|
34
|
-
#
|
|
35
|
-
#
|
|
35
|
+
# Case-insensitive match on the account `name` or the curated
|
|
36
|
+
# `display_name`, prefix match on NUID (so typing a known NUID works too).
|
|
37
|
+
# Atlas caps the result (10 entries) and orders it by the name an entry
|
|
38
|
+
# shows — `display_name` when set, else `name`; a blank query resolves to
|
|
39
|
+
# an empty list.
|
|
36
40
|
#
|
|
37
41
|
# @param query [String] name fragment or NUID prefix to match.
|
|
38
42
|
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
39
43
|
# path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
|
|
40
44
|
# path it is ignored (identity lives in the token).
|
|
41
45
|
# @return [Array<AtlasRb::Mash>, nil] matching directory entries, each
|
|
42
|
-
# carrying `nuid` and `
|
|
46
|
+
# carrying `nuid`, `name` and `display_name` (`nil` without a Person).
|
|
43
47
|
#
|
|
44
48
|
# `nil` when Atlas answers `404` — nothing is there to read, or, with a
|
|
45
49
|
# misconfigured `ATLAS_URL`, the route is not Atlas's at all.
|
|
@@ -48,7 +52,7 @@ module AtlasRb
|
|
|
48
52
|
# Atlas's status and body so the failure is attributable at the boundary.
|
|
49
53
|
# @example Recipient typeahead
|
|
50
54
|
# AtlasRb::User.search("jan", nuid: "000000002")
|
|
51
|
-
# # => [{ "nuid" => "001234567", "name" => "Doe, Jane" }, ...]
|
|
55
|
+
# # => [{ "nuid" => "001234567", "name" => "Doe, Jane", "display_name" => "Jane Doe" }, ...]
|
|
52
56
|
def self.search(query, nuid: nil)
|
|
53
57
|
read_body(connection({ q: query }, nuid).get(ROUTE)) do |body|
|
|
54
58
|
body.map { |entry| AtlasRb::Mash.new(entry) }
|
|
@@ -62,7 +66,8 @@ module AtlasRb
|
|
|
62
66
|
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
63
67
|
# path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
|
|
64
68
|
# path it is ignored (identity lives in the token).
|
|
65
|
-
# @return [AtlasRb::Mash, nil] the `nuid
|
|
69
|
+
# @return [AtlasRb::Mash, nil] the `nuid`, `name` and `display_name`
|
|
70
|
+
# entry (`display_name` is `nil` without a Person), or `nil` when
|
|
66
71
|
# Atlas reports the NUID as absent (unknown, or held by an excluded
|
|
67
72
|
# role — the two are indistinguishable on the wire by design).
|
|
68
73
|
#
|
|
@@ -71,7 +76,7 @@ module AtlasRb
|
|
|
71
76
|
# Atlas's status and body so the failure is attributable at the boundary.
|
|
72
77
|
# @example Sender-name display
|
|
73
78
|
# AtlasRb::User.find_by_nuid("001234567")
|
|
74
|
-
# # => { "nuid" => "001234567", "name" => "Doe, Jane" }
|
|
79
|
+
# # => { "nuid" => "001234567", "name" => "Doe, Jane", "display_name" => "Jane Doe" }
|
|
75
80
|
def self.find_by_nuid(target_nuid, nuid: nil)
|
|
76
81
|
read_body(connection({}, nuid).get("#{ROUTE}/by_nuid/#{target_nuid}")) do |body|
|
|
77
82
|
AtlasRb::Mash.new(body)
|
|
@@ -88,8 +93,8 @@ module AtlasRb
|
|
|
88
93
|
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
89
94
|
# path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
|
|
90
95
|
# path it is ignored (identity lives in the token).
|
|
91
|
-
# @return [Array<AtlasRb::Mash>, nil] resolved entries, each carrying `nuid
|
|
92
|
-
# and `
|
|
96
|
+
# @return [Array<AtlasRb::Mash>, nil] resolved entries, each carrying `nuid`,
|
|
97
|
+
# `name` and `display_name`, ordered by the name an entry shows.
|
|
93
98
|
#
|
|
94
99
|
# `nil` when Atlas answers `404` — nothing is there to read, or, with a
|
|
95
100
|
# misconfigured `ATLAS_URL`, the route is not Atlas's at all.
|
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.
|
|
4
|
+
version: 1.25.0
|
|
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-
|
|
11
|
+
date: 2026-10-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|