[management] fix delete of owner user (#7456)

This commit is contained in:
Pascal Fischer
2026-09-08 13:47:32 +02:00
committed by GitHub
parent e14006ddc1
commit 7a62d63a36
2 changed files with 47 additions and 0 deletions
+4
View File
@@ -1337,6 +1337,10 @@ func (am *DefaultAccountManager) deleteRegularUser(ctx context.Context, accountI
return fmt.Errorf("failed to get user to delete: %w", err)
}
if targetUser.Role == types.UserRoleOwner && targetUser.Id != initiatorUserID {
return status.NewOwnerDeletePermissionError()
}
settings, err = transaction.GetAccountSettings(ctx, store.LockingStrengthNone, accountID)
if err != nil {
return fmt.Errorf("failed to get account settings: %w", err)