当前位置: 首页>>代码示例>>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;未经允许,请勿转载。