Files
Outpost/OutlineKit/Sources/OutlineKit/Models/OutlineMembership.swift
T
Puranjay Savar Mattas 7216633299 feat(share): drop broken Published toggle, add real document permissions
Flipping "Published" 403'd with authorization_error, confirmed via a
raw curl (bypassing our client entirely, real token) to be a genuine
server-side restriction independent of this app — workspace public
sharing is enabled, token is full-scope, it's not document-specific.
Root cause is most likely Outline gating that action behind an
interactive session rather than API-token auth, but that's not
definitively confirmed server-side. Removed the toggle per explicit
instruction; kept link create/copy/revoke and title override (same
endpoint, not reported broken).

Replaced it with real per-document user permissions:
- OutlineMembership/OutlineDocumentMember models
- documents.add_user (confirmed shape from official docs),
  documents.remove_user/documents.users (speculative, same "best-effort
  until a live server confirms" treatment OutlinePin originally got),
  users.list for the invite search (standard, high-confidence)
- DocumentShareSheet gets a "People with access" section: search and
  invite with a Can-view/Can-edit picker, existing members listed with
  a remove button
- Reader toolbar's long-disabled "Permissions…" menu item now opens
  this same sheet instead of doing nothing

Sidebar's own disabled "Permissions…" stub has no sheet wired up to it
yet — comment updated to be accurate, not fixed (use the reader's menu
instead). documents.users/documents.remove_user are unverified against
a live server, same as every other speculative endpoint this session —
expect a correction round once tested.
2026-08-14 20:18:03 +01:00

32 lines
1.5 KiB
Swift

import Foundation
/// A user's explicit permission grant on a document, backed by
/// `documents.add_user`/`documents.remove_user`. Not in the vendored spec —
/// only `documents.add_user`'s shape is confirmed from Outline's official
/// docs; `remove` and the response shape here follow the create/delete and
/// `{data: ...}` conventions used throughout the rest of this API, but
/// aren't verified against a live server yet.
public struct OutlineMembership: Decodable, Identifiable, Sendable {
public let id: String
public let userId: String
public let documentId: String?
/// `"read"` or `"read_write"` per the documented enum.
public let permission: String
}
/// A workspace member as returned by `documents.users` in the context of a
/// specific document — same identity fields as `OutlineUser`, plus (if the
/// server includes it) the permission they hold on that document. Modeled
/// separately from `OutlineUser` rather than adding an optional field there,
/// since `permission` only makes sense in this document-scoped context.
/// Speculative — `documents.users` isn't in the vendored spec, its name is
/// inferred from Outline's usual `<resource>.<verb>` convention and hasn't
/// been confirmed against a live server.
public struct OutlineDocumentMember: Decodable, Identifiable, Sendable {
public let id: String
public let name: String
public let email: String?
public let avatarUrl: String?
public let permission: String?
}