Add page-level permissions and guests

Pages can now be shared with people and groups beyond their space, and
restricted so that only those grants count. A grant covers the page and
everything under it. Space admins always keep access, and an editor who
restricts a page keeps editor through a grant of their own.

Sharing a page with someone from the organization who is outside the
workspace adds them as a guest. Anyone else gets a guest invite that
carries the page grant, which is made when they accept. Guests see a
"limited" space holding only the pages shared with them.

The page tree, breadcrumbs, search, favorites, recents, trash and import
all follow the page role. Public links skip restricted subtrees. Grants
are cleaned up when a member leaves or a group is deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tajniak81andClaude Opus 5.5 committed 2026-10-31 21:39:50 +01:00
1 parent 8aeebbff12
commit 7968e82cc2
29 files changed
+2277 -119

No files matched your search

+184 -7
View File
@@ -1434,6 +1434,133 @@ paths:
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
# Page-level permissions: grants to people and groups, and restricted pages.
/api/v1/pages/{id}/access:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
get:
operationId: getPageAccess
tags: [sharing]
summary: Who has access to the page beyond the space's members (viewer)
security: [{ bearer: [] }]
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PageAccess" }
"404": { $ref: "#/components/responses/Error" }
patch:
operationId: setPageRestricted
tags: [sharing]
summary: Restrict the page and its subpages to the people it is shared with, or lift that (editor)
description: Space admins always keep access. An editor who restricts a page keeps editor on it through a grant.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [restricted]
properties:
restricted: { type: boolean }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PageAccess" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/access/users:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
put:
operationId: sharePageWithUser
tags: [sharing]
summary: Share the page and its subpages with someone by email (editor)
description: >-
A workspace member gets the role on the page. Someone from the workspace's organization who is not
in the workspace joins it as a guest. Anyone else is invited as a guest (workspace members only).
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [email, role]
properties:
email: { type: string, format: email }
role: { $ref: "#/components/schemas/PageGrantRole" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/SharePageResult" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/access/users/{userId}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: userId, in: path, required: true, schema: { type: string } }
delete:
operationId: unsharePageWithUser
tags: [sharing]
summary: Remove someone's grant on the page (editor, or the person themselves)
security: [{ bearer: [] }]
responses:
"200":
description: The page's access afterwards
content:
application/json:
schema: { $ref: "#/components/schemas/PageAccess" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/pages/{id}/access/groups/{groupId}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
- { name: groupId, in: path, required: true, schema: { type: string } }
put:
operationId: sharePageWithGroup
tags: [sharing]
summary: Share the page and its subpages with a group of the workspace (editor)
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [role]
properties:
role: { $ref: "#/components/schemas/PageGrantRole" }
responses:
"200":
description: OK
content:
application/json:
schema: { $ref: "#/components/schemas/PageAccess" }
"400": { $ref: "#/components/responses/Error" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: unsharePageWithGroup
tags: [sharing]
summary: Remove a group's grant on the page (editor)
security: [{ bearer: [] }]
responses:
"200":
description: The page's access afterwards
content:
application/json:
schema: { $ref: "#/components/schemas/PageAccess" }
"403": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
# Public share links: read access for anyone with the link.
/api/v1/pages/{id}/share:
parameters:
@@ -1824,7 +1951,7 @@ components:
description: open - every workspace member gets the default role; private - explicit members only.
Space:
type: object
required: [id, workspace, name, slug, icon, description, visibility, defaultRole, role, created]
required: [id, workspace, name, slug, icon, description, visibility, defaultRole, role, limited, created]
properties:
id: { type: string }
workspace: { type: string }
@@ -1834,7 +1961,8 @@ components:
description: { type: string }
visibility: { $ref: "#/components/schemas/SpaceVisibility" }
defaultRole: { $ref: "#/components/schemas/SpaceDefaultRole" }
role: { $ref: "#/components/schemas/SpaceRole" }
role: { $ref: "#/components/schemas/SpaceCallerRole" }
limited: { type: boolean, description: The caller cannot open the space itself and sees only pages shared with them }
created: { type: string }
SpaceMember:
type: object
@@ -1850,13 +1978,16 @@ components:
role: { $ref: "#/components/schemas/SpaceRole" }
PageNode:
type: object
required: [id, parent, title, icon, position, updated]
required: [id, parent, title, icon, position, restricted, updated]
properties:
id: { type: string }
parent: { type: string, description: Parent page id; empty at the top level }
parent:
type: string
description: Parent page id; empty at the top level. In a page tree, a page whose parent the caller cannot open hangs from its nearest visible ancestor.
title: { type: string }
icon: { type: string }
position: { type: string, description: Fractional sort key among siblings }
restricted: { type: boolean, description: This page itself is restricted }
updated: { type: string }
PageRef:
type: object
@@ -1867,7 +1998,7 @@ components:
icon: { type: string }
Page:
type: object
required: [id, workspace, space, parent, title, icon, created, updated, deletedAt, inTrash, ancestors, role, favorite]
required: [id, workspace, space, parent, title, icon, created, updated, deletedAt, inTrash, ancestors, role, restricted, favorite]
properties:
id: { type: string }
workspace: { type: string }
@@ -1879,9 +2010,55 @@ components:
updated: { type: string }
deletedAt: { type: string, description: When the page itself was trashed; empty otherwise }
inTrash: { type: boolean, description: The page or one of its ancestors is in the trash }
ancestors: { type: array, items: { $ref: "#/components/schemas/PageRef" }, description: Root first }
role: { $ref: "#/components/schemas/SpaceRole" }
ancestors: { type: array, items: { $ref: "#/components/schemas/PageRef" }, description: Root first; pages the caller cannot open are left out }
role: { $ref: "#/components/schemas/SpaceRole", description: The caller's role on this page }
restricted: { type: boolean, description: The page or one of its ancestors is restricted }
favorite: { type: boolean, description: In the caller's favorites }
PageGrantRole: { type: string, enum: [editor, commenter, viewer] }
SpaceCallerRole:
type: string
enum: [admin, editor, commenter, viewer, ""]
description: The caller's space role; empty when they see only pages shared with them
PageGrant:
type: object
required: [type, id, name, email, role, page, inherited]
properties:
type: { type: string, enum: [user, group] }
id: { type: string }
name: { type: string }
email: { type: string, description: Empty for groups }
role: { $ref: "#/components/schemas/PageGrantRole" }
page: { $ref: "#/components/schemas/PageRef", description: Where the grant was made }
inherited: { type: boolean, description: Granted on an ancestor }
PageInvite:
type: object
required: [id, email, role, expires]
properties:
id: { type: string }
email: { type: string }
role: { $ref: "#/components/schemas/PageGrantRole" }
expires: { type: string }
PageAccess:
type: object
required: [restricted, inheritedFrom, grants, invites, role, canManage, canInvite]
properties:
restricted: { type: boolean, description: The page or an ancestor is restricted; space members then see it only through grants }
inheritedFrom:
oneOf: [{ $ref: "#/components/schemas/PageRef" }, { type: "null" }]
description: The restricted ancestor, when the restriction comes from one
grants: { type: array, items: { $ref: "#/components/schemas/PageGrant" }, description: This page's grants first, then inherited ones }
invites: { type: array, items: { $ref: "#/components/schemas/PageInvite" }, description: Pending guest invites for this page (editors only) }
role: { $ref: "#/components/schemas/SpaceRole", description: The caller's role on this page }
canManage: { type: boolean }
canInvite: { type: boolean, description: May share with people outside the workspace, who join as guests }
SharePageResult:
type: object
required: [access, invite]
properties:
access: { $ref: "#/components/schemas/PageAccess" }
invite:
oneOf: [{ $ref: "#/components/schemas/Invite" }, { type: "null" }]
description: Set when the person was invited as a guest; the grant is made when they accept
PageContent:
type: object
required: [content, updated]