Skip to main content

Overview

useRemoveWorkspaceMemberFromSubtree returns a callable that removes a user’s direct memberships on this workspace and every descendant you can reach, in one action. Each deletion fires workspace.member.removed. Authorization: capability-gated + rank-bounded, evaluated per node. Requires remove-member, and the sweep is refused if you are outranked by the target at any node where you both hold a direct member row. An owner (or ancestor owner) reaches the whole subtree via the god-path; a non-owner only reaches descendants through an unbroken open inherit chain, so a sealed sub-workspace (inheritsFromParent = false) is left untouched for a non-owner.
A non-owner’s sweep may be partial — check skipped before you call someone offboarded. If the target still holds a membership in a descendant you cannot reach, it comes back in skippedCount / skipped instead of being removed. removedCount alone does not mean the user is gone from the subtree. An owner or ancestor owner always gets skippedCount: 0.
Owned workspaces block, they do not cascade. Because owners have no member row, this sweep cannot offboard the target from a workspace they own. If they own this workspace or any descendant the call fails with 409 workspace/owns-descendants and nothing is removed. A workspace you have standing on always counts. One you have no standing on (for example a sealed sub-workspace) counts only when the target holds a membership this call would remove; it is then listed without an id or name. An owner of each workspace (or an ancestor owner) reassigns it via useTransferWorkspaceOwnership or deletes it, then retry.

Usage Example

Parameters

string
required
The workspace UUID — the subtree root.
string
required
The target user to offboard — a path param, not an acting user.

Returns

Reading skipped

Each entry names a descendant where the target is still a member after this call.
  • id / name are null when you have no standing on that workspace. The call tells you a membership survived without disclosing the existence or name of a sealed sub-workspace you have no authority over — the same sealing fence useFetchWorkspaceMembers applies to include=descendants. Escalate to an owner or ancestor owner of that branch.
  • reason is currently always "out-of-reach".
  • Only descendants where the target actually still holds a direct membership are listed — unreachable descendants they were never in are never disclosed.

Reading the owned-workspaces block

The 409 body carries ownedWorkspaces: { id: string | null; name: string | null }[] and ownedCount: number (the number of entries in ownedWorkspaces). Entries for workspaces you have standing on carry id and name and are always reported. Owned workspaces you have no standing on are reported as { id: null, name: null }, and only when the target holds a membership this call would remove; otherwise they are left out. Named entries come first, in tree order, then the anonymous ones. Only an owner can transfer ownership, so anonymous entries mean you need an owner of this workspace to resolve them.

Error codes