Example #1
0
 /**
  * Saves the group and right settings
  */
 private function SaveRights()
 {
     $groupID = $this->Value('UserGroup');
     $userGroup = Usergroup::Schema()->ByID($groupID);
     $this->page->SetUserGroup($userGroup);
     if (!$userGroup) {
         $oldRights = $this->page->GetUserGroupRights();
         if ($oldRights) {
             $oldRights->GetContentRights()->Delete();
         }
         $this->page->SetUserGroupRights(null);
     } else {
         $this->pageRights->Save();
         $this->page->SetUserGroupRights($this->pageRights->Rights());
     }
     $this->page->Save();
 }
Example #2
0
 /**
  * Grant evaluation for adding a page on top of the site
  * @param Site $site The site
  * @return GrantResult The result
  */
 function GrantAddPageToSite(Site $site)
 {
     //Dummy page for evaluation
     $page = new Page();
     $page->SetUserGroup($site->GetUserGroup());
     $siteRights = $site->GetUserGroupRights();
     if ($siteRights) {
         $page->SetUserGroupRights($siteRights->GetPageRights());
     }
     return $this->Grant(BackendAction::Create(), $page);
 }