/** * * * @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); }
private function SaveRights() { $groupID = $this->Value('UserGroup'); $userGroup = Usergroup::Schema()->ByID($groupID); $this->site->SetUserGroup($userGroup); if (!$userGroup) { $oldRights = $this->site->GetUserGroupRights(); if ($oldRights) { $oldRights->GetPageRights()->GetContentRights()->Delete(); } $this->site->SetUserGroupRights(null); } else { $this->siteRights->Save(); $this->site->SetUserGroupRights($this->siteRights->Rights()); } $this->site->Save(); }
/** * 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); }