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 descendants block, they do not cascade. Because owners have no member row, this sweep does not cover descendant workspaces the target owns. It fails with 409 workspace/owns-descendants and reports them, rather than silently orphaning ownership. Reassign each via useTransferWorkspaceOwnership or delete 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.

Error codes