Пример #1
0
 /**
  * Saves the page rights
  */
 function Save()
 {
     $this->contentRights->Save();
     if (!$this->rights) {
         $this->rights = new BackendPageRights();
     }
     $this->rights->SetCreateIn($this->Value('CreateIn'));
     $this->rights->SetEdit($this->Value('Edit'));
     $this->rights->SetMove($this->Value('Move'));
     $this->rights->SetRemove($this->Value('Remove'));
     $this->rights->SetContentRights($this->contentRights->Rights());
     $this->rights->Save();
 }
Пример #2
0
 private function GrantGroupOnPage(Usergroup $group, Usergroup $pageGroup, BackendPageRights $pageRights, BackendAction $action)
 {
     if (!$group->Equals($pageGroup)) {
         return GrantResult::NoAccess();
     }
     $allowed = false;
     switch ($action) {
         case BackendAction::Create():
             $allowed = $pageRights->GetCreateIn();
             break;
         case BackendAction::Edit():
             $allowed = $pageRights->GetEdit();
             break;
         case BackendAction::Move():
             $allowed = $pageRights->GetMove();
             break;
         case BackendAction::Delete():
             $allowed = $pageRights->GetRemove();
             break;
         case BackendAction::Read():
             $allowed = $this->HasAnyPageRight($pageRights) || $this->HasAnyContentRight($pageRights->GetContentRights());
     }
     return $allowed ? GrantResult::Allowed() : GrantResult::NoAccess();
 }