atlas_rb 1.6.0 → 1.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: decab10cfb0c67c68615a9695a8c5084aa1bd349e199dccd77a76d024a3e7ba3
4
- data.tar.gz: 90c4db9a3ffd80e9f226334f4862b9982534e431a3a6eb58746bfa96442ee701
3
+ metadata.gz: d84aa1546173f2a0ad397f7bb8f960be544c79c02187013fadf82301efa8afcf
4
+ data.tar.gz: 7873dec712e7bc46d10fd081e2401a96ff980c3c93d97a35799f08edbe701f26
5
5
  SHA512:
6
- metadata.gz: 7fc789c2d47882f6d93664de27f7ab2f2a0d7d43957f4244436600e4247a332c5f8b3df030a5b11fb064187bd55439c0417a04974ca321df88861d47e0da2f15
7
- data.tar.gz: 7189e8bcc3b4d483f623cfdc7a0881f41735646ef085f05a1418436b927fc84c2be514844ea44572c0d2c85f48e057be3a86d5774ac55bf8e09ae3ac4238fc4a
6
+ metadata.gz: 431d703701ca9f01511894590c3680147f96daf702930796acc8bfe6678b7c34eba571087c6ce491daf144797ea2c07bfd345e04d20cf077ff92034ec2c0c886
7
+ data.tar.gz: 83dc3bd542faa2ccca914f0f4029f4ef5427fd0971c641edeeacf607927d93d818e71faa45c9b5637f7f6ed9df0df7600a66bfa420a86965d3a59f71726d4b64
data/.version CHANGED
@@ -1 +1 @@
1
- 1.6.0
1
+ 1.6.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- atlas_rb (1.6.0)
4
+ atlas_rb (1.6.2)
5
5
  faraday (~> 2.7)
6
6
  faraday-follow_redirects (~> 0.3.0)
7
7
  faraday-multipart (~> 1)
@@ -13,7 +13,7 @@ GEM
13
13
  specs:
14
14
  base64 (0.3.0)
15
15
  diff-lcs (1.6.1)
16
- faraday (2.14.2)
16
+ faraday (2.14.3)
17
17
  faraday-net_http (>= 2.0, < 3.5)
18
18
  json
19
19
  logger
@@ -53,16 +53,31 @@ module AtlasRb
53
53
  ))["compilation"]
54
54
  end
55
55
 
56
- # List Compilations, owner-scoped and paginated (newest first).
57
- #
58
- # Defaults to the acting user's own Sets. Pass `owner:` to list another
59
- # user's — that is admin-only and raises {AtlasRb::ForbiddenError} for
60
- # anyone else. There is no public browse surface. Pass `q:` to narrow
61
- # by case-insensitive title substring; the filter applies before
62
- # pagination, so the `"pagination"` block describes the filtered result.
56
+ # List Compilations, paginated (newest first), in one of three modes.
57
+ #
58
+ # Default (no `scope:`) is owner-scoped: the acting user's own Sets. Pass
59
+ # `owner:` to list another user's — admin-only, raising
60
+ # {AtlasRb::ForbiddenError} for anyone else; there is no public browse
61
+ # surface.
62
+ #
63
+ # Pass `scope:` for grant-scoped discovery — Sets where the acting user is
64
+ # a *grantee* but **not** the owner (owned Sets are always excluded; list
65
+ # those with the default mode):
66
+ # - `scope: :editable` — Sets the caller may edit (`edit_users` /
67
+ # `edit_groups` grants).
68
+ # - `scope: :shared` — Sets shared with the caller (`read_groups` grants,
69
+ # plus the edit grants that imply read).
70
+ # Grant-scoped modes are keyed on the acting user; `owner:` is ignored and
71
+ # group membership is resolved server-side. An unknown `scope:` is a 400.
72
+ #
73
+ # Pass `q:` to narrow by case-insensitive title substring in any mode; the
74
+ # filter applies before pagination, so the `"pagination"` block describes
75
+ # the filtered result.
63
76
  #
64
77
  # @param owner [String, nil] NUID whose Sets to list (admin-only when it
65
- # isn't the acting user). Omit for "my Sets".
78
+ # isn't the acting user). Omit for "my Sets". Ignored when `scope:` is set.
79
+ # @param scope [Symbol, String, nil] grant-scoped mode — `:editable` or
80
+ # `:shared`. Omit for the owner-scoped default.
66
81
  # @param q [String, nil] case-insensitive title substring filter.
67
82
  # @param page [Integer, nil] 1-indexed page number.
68
83
  # @param per_page [Integer, nil] page size override.
@@ -82,11 +97,18 @@ module AtlasRb
82
97
  # @example Another user's Sets (admin)
83
98
  # AtlasRb::Compilation.list(owner: "000000002", nuid: "000000004")
84
99
  #
100
+ # @example Sets shared with me that I can edit (not owned)
101
+ # AtlasRb::Compilation.list(scope: :editable, nuid: "000000002")
102
+ #
103
+ # @example Sets shared with me to view (read + edit grants, not owned)
104
+ # AtlasRb::Compilation.list(scope: :shared, nuid: "000000002")
105
+ #
85
106
  # @example Title typeahead
86
107
  # AtlasRb::Compilation.list(q: "course", nuid: "000000002")
87
- def self.list(owner: nil, q: nil, page: nil, per_page: nil, nuid: nil, on_behalf_of: nil)
108
+ def self.list(owner: nil, scope: nil, q: nil, page: nil, per_page: nil, nuid: nil, on_behalf_of: nil)
88
109
  params = {}
89
110
  params[:owner] = owner if owner
111
+ params[:scope] = scope if scope
90
112
  params[:q] = q if q
91
113
  params[:page] = page if page
92
114
  params[:per_page] = per_page if per_page
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AtlasRb
4
+ # System-context callers — see {AtlasRb::System::User} for the namespace
5
+ # rationale (separate bearer token, hard-pinned `User:` header, the class
6
+ # itself as the carve-out marker).
7
+ #
8
+ # Beyond user provisioning, the namespace exposes Atlas's operational,
9
+ # `:system`-gated maintenance actions. These are not user operations — they
10
+ # never appear on the human CRUD surface — so they ride the system path.
11
+ module System
12
+ extend AtlasRb::FaradayHelper
13
+
14
+ # Re-project a single resource's Solr doc from Atlas's current
15
+ # Postgres/OCFL state. Solr-only on the server — no lifecycle transition,
16
+ # no audit event, no optimistic-lock bump. The purpose-built lever for
17
+ # refreshing a stale projection after an indexer ships or changes (e.g.
18
+ # the catalog's `classification_ssim` "Content" facet), without abusing
19
+ # `AtlasRb::Work.complete` to nudge Solr as a finalize side effect.
20
+ #
21
+ # Idempotent. Authenticates as the Atlas `:system` fixture via
22
+ # {FaradayHelper#system_connection}, so there is no way to issue it as a
23
+ # regular user.
24
+ #
25
+ # @param id [String] the NOID of any resource (Work, Collection,
26
+ # Community, FileSet, ...).
27
+ # @return [Faraday::Response] the raw response. Status `204` on success;
28
+ # `404` if the id does not resolve.
29
+ #
30
+ # @example Refresh one drifted Work after a new indexer shipped
31
+ # AtlasRb::System.reindex("neu:abc123")
32
+ def self.reindex(id)
33
+ system_connection.post("/resources/#{id}/reindex")
34
+ end
35
+
36
+ # Re-project a resource AND its full descendant subtree — descendant
37
+ # containers (Collection/Community) plus the Works beneath them, a superset
38
+ # of Atlas's re-parent cascade so Work-level projections refresh too. Same
39
+ # Solr-only, side-effect-free semantics as {.reindex}.
40
+ #
41
+ # Synchronous on the server: rooted at a Collection it refreshes that
42
+ # Collection's contents; rooted at the top Community it backfills the whole
43
+ # repository. For a pathologically large subtree, root lower or drive the
44
+ # cascade in chunks (repeated calls) rather than relying on Atlas to grow a
45
+ # job runner — bulk orchestration lives in the consumer.
46
+ #
47
+ # @param id [String] the NOID of the subtree root.
48
+ # @return [Integer] the number of resources re-projected (the server's
49
+ # `reindexed` count).
50
+ #
51
+ # @example Backfill a Collection's contents after an indexer change
52
+ # AtlasRb::System.reindex_subtree("neu:collection1") # => 42
53
+ def self.reindex_subtree(id)
54
+ response = system_connection.post("/resources/#{id}/reindex_subtree")
55
+ JSON.parse(response.body)["reindexed"]
56
+ end
57
+ end
58
+ end
data/lib/atlas_rb.rb CHANGED
@@ -27,6 +27,7 @@ require_relative "atlas_rb/admin"
27
27
  require_relative "atlas_rb/admin/work"
28
28
  require_relative "atlas_rb/admin/collection"
29
29
  require_relative "atlas_rb/admin/community"
30
+ require_relative "atlas_rb/system"
30
31
  require_relative "atlas_rb/system/user"
31
32
  require_relative "atlas_rb/audit_event"
32
33
 
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.6.0
4
+ version: 1.6.2
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-06-16 00:00:00.000000000 Z
11
+ date: 2026-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -148,6 +148,7 @@ files:
148
148
  - lib/atlas_rb/middleware/raise_on_resource_error.rb
149
149
  - lib/atlas_rb/middleware/raise_on_stale_resource.rb
150
150
  - lib/atlas_rb/resource.rb
151
+ - lib/atlas_rb/system.rb
151
152
  - lib/atlas_rb/system/user.rb
152
153
  - lib/atlas_rb/user.rb
153
154
  - lib/atlas_rb/version.rb