userManager->get($targetUserId); if ($targetUser === null) { $profileNotFoundTemplate->throttle(); return $profileNotFoundTemplate; } if (!$targetUser->isEnabled()) { return $profileNotFoundTemplate; } $visitingUser = $this->userSession->getUser(); if (!$this->profileManager->isProfileEnabled($targetUser)) { return $profileNotFoundTemplate; } // Run user enumeration checks only if viewing another user's profile if ($targetUser !== $visitingUser) { if (!$this->shareManager->currentUserCanEnumerateTargetUser($visitingUser, $targetUser)) { return $profileNotFoundTemplate; } } if ($visitingUser !== null) { $userStatuses = $this->userStatusManager->getUserStatuses([$targetUserId]); $status = $userStatuses[$targetUserId] ?? null; if ($status !== null) { $this->initialStateService->provideInitialState('status', [ 'icon' => $status->getIcon(), 'message' => $status->getMessage(), ]); } } $this->initialStateService->provideInitialState( 'profileParameters', $this->profileManager->getProfileFields($targetUser, $visitingUser), ); if ($targetUser === $visitingUser) { $this->navigationManager->setActiveEntry('profile'); } $this->eventDispatcher->dispatchTyped(new BeforeTemplateRenderedEvent($targetUserId)); \OCP\Util::addScript('core', 'profile'); return new TemplateResponse( 'core', 'profile', [], $this->userSession->isLoggedIn() ? TemplateResponse::RENDER_AS_USER : TemplateResponse::RENDER_AS_PUBLIC, ); } }