コード例 #1
0
ファイル: UserGuard.php プロジェクト: agentmedia/phine-core
 /**
  * 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();
 }
コード例 #2
0
ファイル: PageBranch.php プロジェクト: agentmedia/phine-core
 /**
  * True if page is moveable
  * @param Page $page
  * @return bool
  */
 protected function CanMove()
 {
     return BackendModule::Guard()->Allow(BackendAction::Move(), $this->page);
 }
コード例 #3
0
 /**
  * Returns true if content cane be moved
  * @return boolen
  */
 protected final function CanMove()
 {
     return BackendModule::Guard()->Allow(BackendAction::Move(), $this->content);
 }