feat: show "View X" instead of "Edit X" for read-only users

Titlebar, breadcrumbs, and page title now reflect the user's actual
permission level across all 6 edit pages (roles, users, departments,
tenants, permissions, scheduled jobs). Added i18n keys for de and en.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-22 22:28:19 +01:00
parent 91d8aa5055
commit 06e619f26c
14 changed files with 36 additions and 17 deletions

View File

@@ -14,7 +14,8 @@ $userAvatarService = app(\MintyPHP\Service\User\UserAvatarService::class);
$hasAvatar = $avatarUuid !== '' && $userAvatarService->hasAvatar($avatarUuid);
$currentUserId = (int) ($_SESSION['user']['id'] ?? 0);
$isOwnAccount = $currentUserId > 0 && $currentUserId === (int) ($values['id'] ?? 0);
$titleText = $isOwnAccount ? t('My account') : t('Edit user');
$canEditUser = !empty($canEditUser);
$titleText = $isOwnAccount ? t('My account') : ($canEditUser ? t('Edit user') : t('View user'));
$canViewUsers = !empty($canViewUsers);
$canViewUserMeta = !empty($canViewUserMeta);
$canViewUserAudit = !empty($canViewUserAudit);