/**
  * Saves the content rights
  */
 function Save()
 {
     if (!$this->rights) {
         $this->rights = new BackendContentRights();
     }
     $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->Save();
 }
Beispiel #2
0
 /**
  * Calculates the grant result for a group on a content
  * @param Usergroup $group The evaluated group
  * @param Usergroup $contentGroup The group of the content
  * @param BackendContentRights $contentRights The rights of the content
  * @param BackendAction $action The action that shall be taken for the content
  * @return GrantResult Returns the calculated result
  */
 private function GrantGroupOnContent(Usergroup $group, Usergroup $contentGroup, BackendContentRights $contentRights, BackendAction $action)
 {
     if (!$group->Equals($contentGroup)) {
         return GrantResult::NoAccess();
     }
     $allowed = false;
     switch ($action) {
         case BackendAction::Create():
             $allowed = $contentRights->GetCreateIn();
             break;
         case BackendAction::Edit():
             $allowed = $contentRights->GetEdit();
             break;
         case BackendAction::Move():
             $allowed = $contentRights->GetMove();
             break;
         case BackendAction::Delete():
             $allowed = $contentRights->GetRemove();
             break;
         case BackendAction::Read():
             $allowed = $this->HasAnyContentRight($contentRights);
             break;
     }
     return $allowed ? GrantResult::Allowed() : GrantResult::NoAccess();
 }