/**
  * Checks whether the current user is authorized to access the controller
  * and displays an error page in case permission has been denied.
  *
  * @throws \Ableron\Core\Controller\Exception\AccessDeniedException
  * @return void
  */
 protected function checkAuthorization()
 {
     foreach ($this->getRequiredPermissions() as $permissionName) {
         if (!UserService::hasPermission(Application::getUser(), Application::getPersistenceManager()->getRepository('PermissionEntity')->findByName($permissionName))) {
             throw new AccessDeniedException();
         }
     }
 }
Example #2
0
 /**
  * @see \Ableron\Core\Controller\AbstractController::checkAuthentication()
  */
 protected function checkAuthentication()
 {
     if (UserService::isAuthenticated(Application::getUser())) {
         $this->redirectTo(EnvironmentUtil::getInternalUrl('/'));
     }
 }