service actor undeletable: domain const, 403, hide delete UI

This commit is contained in:
2026-10-26 03:15:27 +01:00
parent 3861d99e1f
commit 9d0166f5cb
12 changed files with 85 additions and 4 deletions

View File

@@ -287,3 +287,18 @@ async fn a_non_admin_gets_forbidden_before_any_password_check() {
assert!(matches!(err, DomainError::Forbidden(_)), "got {err:?}");
}
#[tokio::test]
async fn the_service_actor_cannot_be_deleted_even_by_an_admin() {
let f = fixture();
let admin = f.user("root", UserRole::Admin).await;
let other = f.user("second", UserRole::Admin).await;
let _ = other;
let err = request_account_deletion::execute(&f.deps, admin, UserId::service_actor(), PASSWORD)
.await
.unwrap_err();
assert!(matches!(err, DomainError::Forbidden(_)), "got {err:?}");
assert!(f.store.recorded_events().is_empty());
}