diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 209e6169..9ec92f87 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -45,17 +45,18 @@ class PageController extends Controller /** * Constructor * - * @param IRequest $request The request. - * @param IInitialState $initialState Nextcloud initial-state service. - * @param IDashboardManager $dashboardManager Dashboard widget manager. - * @param IUserSession $userSession Current user session. - * @param IGroupManager $groupManager Group membership lookup. - * @param AdminSettingsService $adminSettings MyDash admin settings. - * @param DashboardService $dashboardService Dashboard service (active - * resolver — REQ-DASH-018). - * @param AdminTemplateService $templateService Template service (primary - * group resolver — - * REQ-TMPL-012). + * @param IRequest $request The request. + * @param IInitialState $initialState Nextcloud initial-state service. + * @param IDashboardManager $dashboardManager Dashboard widget manager. + * @param IUserSession $userSession Current user session. + * @param IGroupManager $groupManager Group membership lookup. + * @param AdminSettingsService $adminSettings MyDash admin settings. + * @param DashboardService $dashboardService Dashboard service (active + * resolver — + * REQ-DASH-018). + * @param AdminTemplateService $templateService Template service (primary + * group resolver — + * REQ-TMPL-012). */ public function __construct( IRequest $request, @@ -88,18 +89,19 @@ public function index(): TemplateResponse // Load all widget scripts so legacy widgets can register their callbacks. $widgets = $this->loadWidgetScripts(); - $user = $this->userSession->getUser(); - $isAdmin = false; - $userId = null; + $user = $this->userSession->getUser(); + $isAdmin = false; + $userId = null; if ($user !== null) { $userId = $user->getUID(); $isAdmin = $this->groupManager->isAdmin(userId: $userId); } // Resolve the primary group via the canonical REQ-TMPL-012 authority. - $primaryGroup = ($userId !== null) - ? $this->templateService->resolvePrimaryGroup(userId: $userId) - : Dashboard::DEFAULT_GROUP_ID; + $primaryGroup = Dashboard::DEFAULT_GROUP_ID; + if ($userId !== null) { + $primaryGroup = $this->templateService->resolvePrimaryGroup(userId: $userId); + } $primaryGroupName = $primaryGroup; if ($primaryGroup !== 'default' diff --git a/lib/Controller/ResponseHelper.php b/lib/Controller/ResponseHelper.php index d9e6f616..9bc2eb27 100644 --- a/lib/Controller/ResponseHelper.php +++ b/lib/Controller/ResponseHelper.php @@ -64,12 +64,12 @@ public static function forbidden( * exception is recorded in the server log; the client only ever sees * the generic `$message` (defaulting to "Operation failed"). * - * @param \Exception $exception The exception. - * @param int $statusCode The HTTP status code. - * @param LoggerInterface|null $logger When provided, the exception is - * logged at ERROR level before - * the response is returned. - * @param string $message Generic client-facing message. + * @param \Exception $exception The exception. + * @param int $statusCode The HTTP status code. + * @param LoggerInterface|null $logger When provided, the exception is + * logged at ERROR level before + * the response is returned. + * @param string $message Generic client-facing message. * * @return JSONResponse The error response. */