Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ protected Void call() {

// ===== Confirmation dialog =====

private boolean confirmDelete(User user) {
/**
* Диалог подтверждения удаления. Выделен в метод ради тестов: headless {@code Alert} блокирует
* поток, поэтому тесты переопределяют его без UI.
*/
protected boolean confirmDelete(User user) {
var alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Удаление пользователя");
alert.setHeaderText(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,19 @@ private void setupTable() {
}

private void setupRbac() {
// NB: services/getAuthService может быть частичным моком в тестах — остаёмся null-safe:
// getAuthService()==null, getCurrentUser()==null и role==null дают скрытые кнопки без NPE,
// т.к. isAdmin() внутри проверяет current и role на null.
var authService = services == null ? null : services.getAuthService();
boolean canCreate = authService != null && authService.isAdmin();
createButton.setVisible(canCreate);
createButton.setManaged(canCreate);

// Кнопка «Ресурсы» доступна только администраторам (как кнопка «Пользователи» на списке
// ресурсов).
boolean isAdmin = authService != null && authService.isAdmin();
resourcesButton.setVisible(isAdmin);
resourcesButton.setManaged(isAdmin);
}

// ===== Data loading =====
Expand Down
Loading