當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Opus_Document::hasEmbargoPassed方法代碼示例

本文整理匯總了PHP中Opus_Document::hasEmbargoPassed方法的典型用法代碼示例。如果您正苦於以下問題:PHP Opus_Document::hasEmbargoPassed方法的具體用法?PHP Opus_Document::hasEmbargoPassed怎麽用?PHP Opus_Document::hasEmbargoPassed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Opus_Document的用法示例。


在下文中一共展示了Opus_Document::hasEmbargoPassed方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isFileAccessAllowed

 private function isFileAccessAllowed($file, $realm)
 {
     if (is_null($file) or !$realm instanceof Opus_Security_IRealm) {
         return false;
     }
     return $realm->checkFile($file->getId()) && $file->getVisibleInFrontdoor() && $this->_doc->hasEmbargoPassed() || $this->getAclHelper()->accessAllowed('documents');
 }
開發者ID:KOBV,項目名稱:opus4-matheon,代碼行數:7,代碼來源:File.php

示例2: getAccessibleFiles

 /**
  * Returns all associated Opus_File objects that are visible in OAI and accessible by user
  * @return array Accessible Opus_File objects
  *
  * TODO check embargo date
  * TODO merge access checks with code for deliver controller
  */
 public function getAccessibleFiles()
 {
     $realm = Opus_Security_Realm::getInstance();
     // admins sollen immer durchgelassen werden, nutzer nur wenn das doc im publizierten Zustand ist
     if (!$realm->skipSecurityChecks()) {
         // kein administrator
         // PUBLISHED Dokumente sind immer verfügbar (Zugriff auf Modul kann eingeschränkt sein)
         if ($this->_doc->getServerState() !== 'published') {
             // Dokument nicht published
             if (!$realm->checkDocument($this->_docId)) {
                 // Dokument ist nicht verfügbar für aktuellen Nutzer
                 $this->logErrorMessage('document id =' . $this->_docId . ' is not published and access is not allowed for current user');
                 throw new Oai_Model_Exception('access to requested document is forbidden');
             }
         }
         if ($this->_doc->hasEmbargoPassed() === false) {
             if (!$realm->checkDocument($this->_docId)) {
                 // Dokument ist nicht verfügbar für aktuellen Nutzer
                 $this->logErrorMessage('document id =' . $this->_docId . ' is not embargoed and access is not allowed for current user');
                 throw new Oai_Model_Exception('access to requested document files is embargoed');
             }
         }
     }
     $files = array();
     $filesToCheck = $this->_doc->getFile();
     /* @var $file Opus_File */
     foreach ($filesToCheck as $file) {
         $filename = $this->_appConfig->getFilesPath() . $this->_docId . DIRECTORY_SEPARATOR . $file->getPathName();
         if (is_readable($filename)) {
             array_push($files, $file);
         } else {
             $this->logErrorMessage("skip non-readable file {$filename}");
         }
     }
     if (empty($files)) {
         $this->logErrorMessage('document with id ' . $this->_docId . ' does not have any associated files');
         throw new Oai_Model_Exception('requested document does not have any associated readable files');
     }
     $containerFiles = array();
     /* @var $file Opus_File */
     foreach ($files as $file) {
         if ($file->getVisibleInOai() && $realm->checkFile($file->getId())) {
             array_push($containerFiles, $file);
         }
     }
     if (empty($containerFiles)) {
         $this->logErrorMessage('document with id ' . $this->_docId . ' does not have associated files that are accessible');
         throw new Oai_Model_Exception('access denied on all files that are associated to the requested document');
     }
     return $containerFiles;
 }
開發者ID:KOBV,項目名稱:opus4-matheon,代碼行數:58,代碼來源:Container.php

示例3: checkIfFileEmbargoHasPassed

 /**
  * Invokes Opus_Document::hasEmbargoPassed(); compares EmbargoDate with parameter or system time.
  *
  * @param Opus_Date $now
  * @return bool true - if embargo date has passed; false - if not
  */
 public static function checkIfFileEmbargoHasPassed($docId)
 {
     $doc = new Opus_Document($docId);
     return $doc->hasEmbargoPassed();
 }
開發者ID:esmo,項目名稱:opus4-application,代碼行數:11,代碼來源:IndexController.php

示例4: _addAccessRights

 private function _addAccessRights(DOMNode $domNode, Opus_Document $doc)
 {
     $visible = 0;
     $files = $doc->getFile();
     if (count($files) > 0) {
         foreach ($files as $file) {
             if ($file->getField('VisibleInOai')->getValue() && $file->getField('VisibleInFrontdoor')->getValue()) {
                 $visible = 1;
             }
         }
     } else {
         $visible = 1;
     }
     if (!$doc->hasEmbargoPassed()) {
         $visible = 2;
     }
     $fileElement = $domNode->ownerDocument->createElement('Rights');
     switch ($visible) {
         case 0:
             $fileElement->setAttribute('Value', 'info:eu-repo/semantics/closedAccess');
             break;
         case 1:
             $fileElement->setAttribute('Value', 'info:eu-repo/semantics/openAccess');
             break;
         case 2:
             $fileElement->setAttribute('Value', 'info:eu-repo/semantics/embargoedAccess');
             break;
         case 3:
             $fileElement->setAttribute('Value', 'info:eu-repo/semantics/restrictedAccess');
             break;
     }
     $domNode->appendChild($fileElement);
 }
開發者ID:belapp,項目名稱:opus4-application,代碼行數:33,代碼來源:IndexController.php


注:本文中的Opus_Document::hasEmbargoPassed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。