/** * Simulate frontenduser login for backend adminstrators only * * @param User $user * @throws UnauthorizedException * @return void */ public function loginAsAction(User $user) { if (!BackendUserUtility::isAdminAuthentication()) { throw new UnauthorizedException(LocalizationUtility::translate('error_not_authorized')); } UserUtility::login($user); $this->redirectByAction('loginAs', 'redirect'); $this->redirectToUri('/'); }
/** * Check if a backenduser-administrator is logged in * * @return bool */ public function render() { return BackendUserUtility::isAdminAuthentication(); }