atlas_rb 1.6.4 → 1.6.5
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/Gemfile.lock +1 -1
- data/lib/atlas_rb/person.rb +33 -12
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 19c01cf68a6a94d94dceff16d5e8ea00e147b8db2c6fd51f8d6c1e9b8ec36fac
|
|
4
|
+
data.tar.gz: 457092385fc63ed58a2c2e871983bfb2a62d2d69448a74c78796d6a6f14506be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2008dd0082b8de90ca4016a8a66c378bc88a6a6cc61b44070d9fcf9c9fd13ed5d21f81787dbd1b0131194b8edbd10eaf4904366c5e496452fd689fe2eedab429
|
|
7
|
+
data.tar.gz: 801b406750972c2dc014c4e202fcb53a2d204e554197c5594015f4dd0c0b60d58839ad6aab8b7c8659399082618483be9bc918543355f06d6a7ad3d125ed7107
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.6.
|
|
1
|
+
1.6.5
|
data/Gemfile.lock
CHANGED
data/lib/atlas_rb/person.rb
CHANGED
|
@@ -7,30 +7,51 @@ module AtlasRb
|
|
|
7
7
|
# `users.name` is frequently wrong and is clobbered on every login), plus
|
|
8
8
|
# community affiliations.
|
|
9
9
|
#
|
|
10
|
-
# Addressed by
|
|
11
|
-
#
|
|
12
|
-
# the `nuid:` / `on_behalf_of:` keywords
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
10
|
+
# Addressed by **NOID** (like Work/Collection) — the staff-facing NUID is kept
|
|
11
|
+
# server-side and never put in a public URL. So the positional `id` argument
|
|
12
|
+
# below is the person's **NOID**, and the `nuid:` / `on_behalf_of:` keywords
|
|
13
|
+
# keep their usual gem meaning (the acting principal). NUID stays the key only
|
|
14
|
+
# for {.create} (one Person per NUID — and there `nuid:` is the *new person's*
|
|
15
|
+
# NUID, acting principal coming from the ambient `AtlasRb.config.default_nuid`)
|
|
16
|
+
# and {.resolve} (the server-side name-resolution batch). {.list} is the
|
|
17
|
+
# NOID-keyed People-index source.
|
|
16
18
|
#
|
|
17
19
|
# Create / update / affiliation writes are :system + admin on the server; a
|
|
18
20
|
# non-privileged caller gets a 403.
|
|
19
21
|
class Person < Resource
|
|
20
22
|
ROUTE = "/people/"
|
|
21
23
|
|
|
22
|
-
# Fetch a Person by
|
|
24
|
+
# Fetch a Person by NOID.
|
|
23
25
|
#
|
|
24
|
-
# @param id [String] the person's
|
|
26
|
+
# @param id [String] the person's NOID.
|
|
25
27
|
# @param nuid [String, nil] acting principal (signed into the assertion sub).
|
|
26
28
|
# @param on_behalf_of [String, nil] acting-as target.
|
|
27
|
-
# @return [AtlasRb::Mash] the unwrapped `"person"` object
|
|
29
|
+
# @return [AtlasRb::Mash] the unwrapped `"person"` object (carries the
|
|
30
|
+
# server-side `nuid` for callers that need it, e.g. depositor gating).
|
|
28
31
|
def self.find(id, nuid: nil, on_behalf_of: nil)
|
|
29
32
|
AtlasRb::Mash.new(JSON.parse(
|
|
30
33
|
connection({}, nuid, on_behalf_of: on_behalf_of).get(ROUTE + id)&.body
|
|
31
34
|
))["person"]
|
|
32
35
|
end
|
|
33
36
|
|
|
37
|
+
# List people — the NOID-keyed People-index source. Returns the page's
|
|
38
|
+
# Persons (each with `noid`, `display_name`, and the server-side `nuid`), so
|
|
39
|
+
# a consumer builds the index and profiles entirely through atlas_rb without
|
|
40
|
+
# routing People through the catalog/Solr or exposing a NUID publicly.
|
|
41
|
+
#
|
|
42
|
+
# @param page [Integer, nil] 1-based page (server default when nil).
|
|
43
|
+
# @param per_page [Integer, nil] page size (server default when nil; capped
|
|
44
|
+
# server-side).
|
|
45
|
+
# @param nuid [String, nil] acting principal.
|
|
46
|
+
# @param on_behalf_of [String, nil] acting-as target.
|
|
47
|
+
# @return [Array<AtlasRb::Mash>] one unwrapped `"person"` per row on the page.
|
|
48
|
+
def self.list(page: nil, per_page: nil, nuid: nil, on_behalf_of: nil)
|
|
49
|
+
params = { page: page, per_page: per_page }.compact
|
|
50
|
+
JSON.parse(
|
|
51
|
+
connection(params, nuid, on_behalf_of: on_behalf_of).get(ROUTE)&.body
|
|
52
|
+
)["people"].map { |entry| AtlasRb::Mash.new(entry["person"]) }
|
|
53
|
+
end
|
|
54
|
+
|
|
34
55
|
# Batch-resolve people to their authoritative display_name in one call
|
|
35
56
|
# (supersedes the SSO users directory's resolve). Unresolved NUIDs drop.
|
|
36
57
|
#
|
|
@@ -64,7 +85,7 @@ module AtlasRb
|
|
|
64
85
|
# Edit a Person's authority fields. NUID is immutable and not patchable.
|
|
65
86
|
# Only supplied fields are changed.
|
|
66
87
|
#
|
|
67
|
-
# @param id [String] the person's
|
|
88
|
+
# @param id [String] the person's NOID.
|
|
68
89
|
# @param display_name [String, nil]
|
|
69
90
|
# @param bio [String, nil]
|
|
70
91
|
# @param orcid [String, nil]
|
|
@@ -81,7 +102,7 @@ module AtlasRb
|
|
|
81
102
|
|
|
82
103
|
# Add a community affiliation (idempotent; audited server-side).
|
|
83
104
|
#
|
|
84
|
-
# @param id [String] the person's
|
|
105
|
+
# @param id [String] the person's NOID.
|
|
85
106
|
# @param community_id [String] the community's NOID.
|
|
86
107
|
# @param nuid [String, nil] acting principal.
|
|
87
108
|
# @param on_behalf_of [String, nil] acting-as target.
|
|
@@ -96,7 +117,7 @@ module AtlasRb
|
|
|
96
117
|
|
|
97
118
|
# Remove a community affiliation (tolerant; audited server-side).
|
|
98
119
|
#
|
|
99
|
-
# @param id [String] the person's
|
|
120
|
+
# @param id [String] the person's NOID.
|
|
100
121
|
# @param community_id [String] the community's NOID.
|
|
101
122
|
# @param nuid [String, nil] acting principal.
|
|
102
123
|
# @param on_behalf_of [String, nil] acting-as target.
|