From 174f05ae62446c17b2bb75d8642d037a90e0add5 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Mon, 10 Aug 2026 13:12:04 +0200 Subject: [PATCH 1/3] Prevent an admin from deleting their own account Backport of the UFAL self-delete guard from dtq-dev (dspace-angular #1335, #1357, #1373) to this customer branch. The EPeople registry and the EPerson form now hide/disable the delete action for the currently authenticated user (with an explanatory tooltip), show a contextual warning in the confirmation modal when the target is a submitter and/or an administrator, and surface a friendly notification when the backend rejects a self-delete. Shared logic lives in the new EPersonDeleteGuardService so both call sites stay in sync. Refs dataquest-dev/dspace-customers#855 --- .../epeople-registry.component.html | 24 ++- .../epeople-registry.component.spec.ts | 31 ++++ .../epeople-registry.component.ts | 61 +++++-- .../eperson-delete-guard.service.spec.ts | 158 ++++++++++++++++++ .../eperson-delete-guard.service.ts | 153 +++++++++++++++++ .../eperson-form/eperson-form.component.html | 20 ++- .../eperson-form.component.spec.ts | 28 ++++ .../eperson-form/eperson-form.component.ts | 87 +++++++--- .../confirmation-modal.component.html | 3 + .../confirmation-modal.component.ts | 1 + src/app/shared/testing/auth-service.stub.ts | 4 + src/assets/i18n/cs.json5 | 12 ++ src/assets/i18n/en.json5 | 8 + 13 files changed, 544 insertions(+), 46 deletions(-) create mode 100644 src/app/access-control/epeople-registry/eperson-delete-guard.service.spec.ts create mode 100644 src/app/access-control/epeople-registry/eperson-delete-guard.service.ts diff --git a/src/app/access-control/epeople-registry/epeople-registry.component.html b/src/app/access-control/epeople-registry/epeople-registry.component.html index c054a5dd55e..498ecf0c9a2 100644 --- a/src/app/access-control/epeople-registry/epeople-registry.component.html +++ b/src/app/access-control/epeople-registry/epeople-registry.component.html @@ -74,12 +74,24 @@