本文整理汇总了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');
}
示例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;
}
示例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();
}
示例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);
}