Пример #1
0
 public function __construct($object = false)
 {
     if ($object) {
         $this->response = PermissionResponse::getResponse($object);
         $r = $this->response->testForErrors();
         if ($r) {
             $this->error = $r;
         }
     }
 }
 public function testForErrors()
 {
     if (!$this->object->getVersionID()) {
         $c = Page::getByID($this->object->getCollectionID());
         $cp = new Permissions($c);
         if ($cp->canViewPageVersions()) {
             return COLLECTION_FORBIDDEN;
         } else {
             return COLLECTION_NOT_FOUND;
         }
     } elseif (!$this->object->isMostRecent()) {
         return VERSION_NOT_RECENT;
     }
     return parent::testForErrors();
 }
Пример #3
0
 public function testForErrors()
 {
     if ($this->object->isMasterCollection()) {
         $canEditMaster = TaskPermission::getByHandle('access_page_defaults')->can();
         if (!($canEditMaster && Session::get('mcEditID') == $this->object->getCollectionID())) {
             return COLLECTION_FORBIDDEN;
         }
     } else {
         if (!$this->canViewPage() && !$this->object->getCollectionPointerExternalLink() != '') {
             return COLLECTION_FORBIDDEN;
         }
     }
     return parent::testForErrors();
 }