Example #1
0
 /**
  * Clones the protection of this page to another page
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page Page to get the same protection as $this
  * @param boolean $frontend Wheter the front- or backend protection should be cloned
  * @return boolean True on success, false otherwise
  */
 public function copyProtection($page, $frontend)
 {
     if ($frontend) {
         $accessId = $this->getFrontendAccessId();
     } else {
         $accessId = $this->getBackendAccessId();
     }
     $groups = \Permission::getGroupIdsForAccessId($accessId);
     if ($frontend) {
         $page->setFrontendProtection($this->isFrontendProtected());
         $newAccessId = $page->getFrontendAccessId();
     } else {
         $page->setBackendProtection($this->isBackendProtected());
         $newAccessId = $page->getBackendAccessId();
     }
     foreach ($groups as $groupId) {
         if (!\Permission::setAccess($newAccessId, 'dynamic', $groupId)) {
             return false;
         }
     }
     return true;
 }
 public function setBackendProtection($enabled)
 {
     $this->_load();
     return parent::setBackendProtection($enabled);
 }