The first pass had admin/users sharing the address book profile partial, which surfaced Contact/Address/Organization/About tabs that ignored the admin-specific context. Separates the admin quick-view so it mirrors the edit-page tab structure while staying read-only. - `UserProfileViewService::buildAdminProfile()` extends the base profile with `admin_extras` (active, email_verified_at, last_login_at, last_login_provider, created, modified). - `templates/partials/app-admin-user-profile.phtml` is the admin-only render path: Master data · Organization · Security · About. Status badge under the name; timestamps locale-formatted. - `pages/admin/users/view-fragment($id).php` / `(none).phtml` switched to the admin service method + partial. - Drawer CSS aligns the aside with the main section's inline padding so the content strip does not visually step in/out. Address book is unchanged — still uses `buildProfile()` + the base partial. Two i18n keys added (`Login provider`). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
use MintyPHP\Http\SessionStoreInterface;
|
|
use MintyPHP\Service\Access\AuthorizationService;
|
|
use MintyPHP\Service\Access\UserAuthorizationPolicy;
|
|
use MintyPHP\Service\User\UserProfileViewService;
|
|
use MintyPHP\Support\Guard;
|
|
|
|
$session = app(SessionStoreInterface::class)->all();
|
|
Guard::requireLogin();
|
|
|
|
$currentUserId = (int) ($session['user']['id'] ?? 0);
|
|
$uuid = trim((string) ($id ?? ''));
|
|
if ($uuid === '') {
|
|
http_response_code(400);
|
|
return;
|
|
}
|
|
|
|
$decision = app(AuthorizationService::class)->authorize(UserAuthorizationPolicy::ABILITY_ADMIN_USERS_VIEW, [
|
|
'actor_user_id' => $currentUserId,
|
|
]);
|
|
if (!$decision->isAllowed()) {
|
|
http_response_code(403);
|
|
$user = null;
|
|
return;
|
|
}
|
|
|
|
$profile = app(UserProfileViewService::class)->buildAdminProfile($currentUserId, $uuid);
|
|
$status = (string) ($profile['status'] ?? '');
|
|
if ($status === 'not_found' || $status === 'invalid_uuid') {
|
|
http_response_code(404);
|
|
$user = null;
|
|
return;
|
|
}
|
|
if ($status === 'forbidden') {
|
|
http_response_code(403);
|
|
$user = null;
|
|
return;
|
|
}
|
|
$user = $profile['user'] ?? null;
|
|
if (!is_array($user)) {
|
|
http_response_code(404);
|
|
$user = null;
|
|
return;
|
|
}
|