mirror of
https://github.com/hanzoai/iam.git
synced 2026-11-19 18:37:16 +00:00
Only an owner, or a SuperAdmin, deletes an org (the op seam asks authz OwnerOf) or gives, takes or hands over the owner role; an admin runs members and admins, and an application that administers orgs owns nothing. PUT /v1/iam/memberships sets the org-wide role one holds. The last owner stays: the store refuses, in the same transaction, the delete, demotion or account removal that would leave an org with none. No other person writes an owner's account: an admin who could reset it could sign in as the owner. A workspace or project row admits its org as a member and administers nothing there, in the orgs claim and in the Guard alike, so a space's owner no longer reads as its org's admin. A home account's role is the higher of its isAdmin bit and its home row. Only the admin org's own accounts are its members: EnsureMembershipIn refuses any other, whoever asks. An org created with a founder is born owned; at boot every ownerless org gets the founder it recorded, and the orgs with none and the admin-org memberships of other orgs' accounts are each filed once on the audit trail. Every role change and org delete is recorded under the org.