Example #1
0
 public function setSitemapInfo($urlInfo)
 {
     $adminUrl = '';
     // Если это скрипт и у него обозначен admin_page
     if (!empty($urlInfo['script']) && !empty($urlInfo['script_admin_url'])) {
         $adminUrl = \Extasy\CMS::getDashboardWWWRoot() . $urlInfo['script_admin_url'];
     } elseif (!empty($urlInfo['document_name'])) {
         if (ModelHelper::isEditable($urlInfo['document_name'])) {
             $adminUrl = \Extasy\CMS::getDashboardWWWRoot() . 'sitemap/edit.php?id=' . $urlInfo['id'];
         }
     }
     if (!empty($adminUrl)) {
         $this->setAdminUrl($adminUrl);
     }
 }
Example #2
0
 protected function checkUserHasEnoughRights()
 {
     $isEditable = ModelHelper::isEditable($this->document);
     if (!$isEditable) {
         $error = sprintf('Document `%s` not editable for current user', $this->document->getModelName());
         throw new ForbiddenException($error);
     }
 }
Example #3
0
 public function testThatIsEditableSupportsObjects()
 {
     $this->AssertFalse(ModelHelper::isEditable(new TestModel()));
     UsersLogin::login(self::LoginFixture, self::PasswordFixture);
     $this->AssertTrue(ModelHelper::isEditable(new TestModel()));
 }
Example #4
0
 protected function filterNotEditableDocuments($dataList)
 {
     $result = array();
     foreach ($dataList as $key => $row) {
         $documentName = $row['document_name'];
         if (empty($documentName)) {
             $result[] = $row;
             continue;
         }
         $isEditable = ModelHelper::isEditable($documentName);
         if ($isEditable) {
             $result[] = $row;
         } else {
         }
     }
     return $result;
 }