Class: AtlasRb::System::Work

Inherits:
Object
  • Object
show all
Extended by:
FaradayHelper
Defined in:
lib/atlas_rb/system/work.rb

Overview

Showcase publishing: link a freshly-created Work into a depositor's featured showcase Collection on their behalf, without granting the depositor themselves standing edit rights on that shared Collection.

Atlas scopes this narrowly on both sides (see Atlas's Ability): the target Collection must be featured, and the Work must belong to the on_behalf_of NUID — never an arbitrary or private Work. Cerberus's WorkDeposit#create_published ("Publish to my community") is the one caller today.

Always authenticates via FaradayHelper#system_connection, so there is no way to issue this as a regular user.

Constant Summary

Constants included from FaradayHelper

FaradayHelper::ASSERTION_AUDIENCE, FaradayHelper::ASSERTION_ISSUER, FaradayHelper::ASSERTION_TTL, FaradayHelper::INSTRUMENTATION_EVENT

Class Method Summary collapse

Methods included from FaradayHelper

connection, multipart, system_connection, with_file_part

Class Method Details

.add_linked_member(work_id, collection_id, on_behalf_of:) ⇒ Array<String>

Returns the Work's full set of linked Collection noids after the add.

Examples:

From Cerberus's publish-to-showcase deposit branch

AtlasRb::System::Work.add_linked_member(work.id, showcase.id, on_behalf_of: depositor_nuid)

Parameters:

  • work_id (String)

    the Work ID to link.

  • collection_id (String)

    the (must-be-featured) showcase Collection to link the Work into.

  • on_behalf_of (String)

    the depositor NUID this write is attributed to — required (unlike the regular, human-facing Work.add_linked_member), since a :system call with no attribution defeats the point of this path, and Atlas's Ability grant is itself conditioned on it matching the Work's depositor.

Returns:

  • (Array<String>)

    the Work's full set of linked Collection noids after the add.

Raises:



40
41
42
43
44
45
# File 'lib/atlas_rb/system/work.rb', line 40

def self.add_linked_member(work_id, collection_id, on_behalf_of:)
  JSON.parse(
    system_connection({ collection_id: collection_id }, on_behalf_of: on_behalf_of)
      .post("/works/#{work_id}/linked_members")&.body
  )
end