/**
  * Does the user have permissions to see this link?
  *
  * @param array $permittedRoles Roles to check
  *
  * @return bool
  */
 public function usersRoleHasPermissions(array $permittedRoles)
 {
     if (empty($permittedRoles)) {
         return true;
     }
     foreach ($permittedRoles as $role) {
         if ($this->permissionChecks->hasRoleBasedAccess($role)) {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * Get the Admin Menu Bar
  *
  * @return mixed
  */
 public function getAdminWrapperAction()
 {
     $allowed = $this->cmsPermissionChecks->siteAdminCheck($this->currentSite);
     if (!$allowed) {
         return null;
     }
     /** @var RouteMatch $routeMatch */
     $routeMatch = $this->getEvent()->getRouteMatch();
     $siteId = $this->currentSite->getSiteId();
     $sourcePageName = $routeMatch->getParam('page', 'index');
     if ($sourcePageName instanceof Page) {
         $sourcePageName = $sourcePageName->getName();
     }
     $pageType = $routeMatch->getParam('pageType', 'n');
     $view = new ViewModel();
     $view->setVariable('restrictions', false);
     if ($this->cmsPermissionChecks->isPageRestricted($siteId, $pageType, $sourcePageName, 'read') == true) {
         $view->setVariable('restrictions', true);
     }
     $view->setVariable('adminMenu', $this->adminPanelConfig);
     $view->setTemplate('rcm-admin/admin/admin');
     return $view;
 }
Exemplo n.º 3
0
 /**
  * Redirect to a page
  *
  * @param string $siteId   Site Id
  * @param string $pageName Page Name
  * @param string $pageType Page Type
  *
  * @return \Zend\Http\Response
  */
 public function __invoke($siteId, $pageName, $pageType = 'n')
 {
     return $this->checker->shouldShowRevisions($siteId, $pageName, $pageType);
 }
Exemplo n.º 4
0
 /**
  * isAdmin
  *
  * @param Site $site Site to check
  *
  * @return \Zend\Http\Response
  */
 public function __invoke(Site $site)
 {
     return $this->checker->siteAdminCheck($site);
 }
Exemplo n.º 5
0
 /**
  * isAdmin
  *
  * @param Page $page Page to check
  *
  * @return \Zend\Http\Response
  */
 public function __invoke(Page $page)
 {
     return $this->checker->isPageAllowedForReading($page);
 }