Skip to main content
Version: v1.0.0(int)

W018: Remove user from organization

Revokes a member's access to the organization. Triggered from Settings, Users.

Steps

  1. Reject self-removal. A user cannot remove themselves through this workflow; they must demote first or transfer ownership. A future "leave organization" workflow is out of scope for v1.

  2. Confirm the target is a member. Call Platform.getMembership(targetUserId, orgId). If no row exists, reject.

  3. Guard against orphaning the org. If the target's role is owner, call Platform.countOwners(orgId). Reject if the count would drop to zero after the removal.

  4. Remove the membership. Call Platform.removeMembership(targetUserId, orgId).

Returns

Nothing.

Business rules

  • Owner-count invariant. Removing the last owner is rejected.
  • No self-removal here. A user cannot remove themselves through this workflow. The leave-organization flow is out of scope for v1.
  • Only owners can remove members. Enforced at the request boundary.

Errors

  • NotFoundError. The target user is not a member.
  • ValidationError. The caller is targeting themselves.
  • InvalidTransitionError. Removal would orphan the org.