Archive manual users on remove

Switch remove-user behavior for manually managed profiles from hard\ndelete to archival by deactivating the profile. This matches the\nrequested SCIM-like lifecycle while avoiding dependency errors for\nlinked records such as signatures and assets.\n\nThe remove flow now updates profile state to INACTIVE, updates\nmembership timestamps, and emits a user-updated webhook event instead of\ndelete events. E2E coverage now asserts that remove keeps the profile\nand marks it inactive.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
Cursor Agent
2026-05-27 00:32:16 +00:00
committed by Bryan Frimin
parent ffa3db3cd2
commit b50bbc8d6a
6 changed files with 36 additions and 143 deletions

View File

@@ -169,18 +169,6 @@ func (e ErrLastActiveOwner) Error() string {
return fmt.Sprintf("cannot remove profile %q: last active owner of the organization", e.MembershipID)
}
type ErrUserReferencedByRecords struct {
ProfileID gid.GID
}
func NewUserReferencedByRecordsError(profileID gid.GID) error {
return &ErrUserReferencedByRecords{ProfileID: profileID}
}
func (e ErrUserReferencedByRecords) Error() string {
return "cannot remove user because they are referenced by existing records (for example signatures, tasks, assets, or risks)"
}
type ErrOrganizationNotFound struct{ OrganizationID gid.GID }
func NewOrganizationNotFoundError(organizationID gid.GID) error {