コード例 #1
0
ファイル: PageForm.php プロジェクト: agentmedia/phine-core
 /**
  * 
  * 
  * @return PageRights
  */
 protected function InitPageRights()
 {
     $rights = $this->page->Exists() ? $this->page->GetUserGroupRights() : null;
     $parentRights = null;
     if ($this->parent) {
         $parentRights = RightsFinder::FindPageRights($this->parent);
     }
     if (!$parentRights) {
         $siteRights = $this->site->GetUserGroupRights();
         if ($siteRights) {
             $parentRights = $this->site->GetUserGroupRights()->GetPageRights();
         }
     }
     $this->pageRights = new PageRights($parentRights, $rights);
 }
コード例 #2
0
ファイル: ContentForm.php プロジェクト: agentmedia/phine-core
 /**
  *  Finds the parent rights
  *  @return BackendContentRights
  */
 private function FindParentRights()
 {
     $parentRights = null;
     $parentContent = $this->Content()->Exists() ? ContentTreeUtil::ParentOf($this->Content()) : null;
     if ($parentContent) {
         $parentRights = RightsFinder::FindContentRights($parentContent);
     }
     if (!$parentRights) {
         switch ($this->Location()) {
             case Enums\ContentLocation::Page():
                 $pageRights = RightsFinder::FindPageRights($this->Page());
                 $parentRights = $pageRights ? $pageRights->GetContentRights() : null;
                 break;
             case Enums\ContentLocation::Layout():
                 $layoutRights = $this->Area()->GetLayout()->GetUserGroupRights();
                 $parentRights = $layoutRights ? $layoutRights->GetContentRights() : null;
                 break;
             case Enums\ContentLocation::Container():
                 $containerRights = $this->Container()->GetUserGroupRights();
                 $parentRights = $containerRights ? $containerRights->GetContentRights() : null;
                 break;
         }
     }
     return $parentRights;
 }
コード例 #3
0
ファイル: UserGuard.php プロジェクト: agentmedia/phine-core
 /**
  * Grant evaluation for adding content on top of a page area
  * @param Page $page The page
  * @return GrantResult GrantResult Returns the grant result telling if creation is allowed
  */
 function GrantAddContentToPage(Page $page)
 {
     //dummy content for evaluation
     $content = new Content();
     $content->SetUserGroup(GroupFinder::FindPageGroup($page));
     $pageRights = RightsFinder::FindPageRights($page);
     if ($pageRights) {
         $content->SetUserGroupRights($pageRights->GetContentRights());
     }
     return $this->Grant(BackendAction::Create(), $content);
 }