-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #150 from OPUS4/4.6.3
OPUSVIER-3951 - OPUS 4.6.3 Release
- Loading branch information
Showing
139 changed files
with
6,729 additions
and
1,886 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,9 +27,8 @@ | |
* @category Application | ||
* @package Controller_Helper | ||
* @author Jens Schwidder <[email protected]> | ||
* @copyright Copyright (c) 2008-2013, OPUS 4 development team | ||
* @copyright Copyright (c) 2008-2018, OPUS 4 development team | ||
* @license http://www.gnu.org/licenses/gpl.html General Public License | ||
* @version $Id$ | ||
*/ | ||
|
||
/** | ||
|
@@ -40,11 +39,13 @@ | |
* TODO weiter ausbauen und mit Opus_Security_IRealm konsolidieren (Framework vs. Application Security) | ||
*/ | ||
class Application_Controller_Action_Helper_AccessControl extends Zend_Controller_Action_Helper_Abstract | ||
implements Application_Security_AccessControl { | ||
implements Application_Security_AccessControl | ||
{ | ||
|
||
private $_acl; | ||
|
||
public function direct($resource) { | ||
public function direct($resource) | ||
{ | ||
return $this->accessAllowed($resource); | ||
} | ||
|
||
|
@@ -59,7 +60,8 @@ public function direct($resource) { | |
* @param $resource | ||
* @return bool | ||
*/ | ||
public function accessAllowed($resource) { | ||
public function accessAllowed($resource) | ||
{ | ||
$acl = $this->getAcl(); | ||
|
||
if (strlen(trim($resource)) == 0) { | ||
|
@@ -78,15 +80,16 @@ public function accessAllowed($resource) { | |
* Returns the Zend_Acl object or null. | ||
* @return Zend_Acl | ||
*/ | ||
protected function getAcl() { | ||
protected function getAcl() | ||
{ | ||
if (is_null($this->_acl)) { | ||
$this->_acl = Zend_Registry::isRegistered('Opus_Acl') ? Zend_Registry::get('Opus_Acl') : null; | ||
} | ||
return $this->_acl; | ||
} | ||
|
||
public function setAcl($acl) { | ||
public function setAcl($acl) | ||
{ | ||
$this->_acl = $acl; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
* @category Application | ||
* @package Application_Configuration | ||
* @author Jens Schwidder <[email protected]> | ||
* @copyright Copyright (c) 2017 | ||
* @copyright Copyright (c) 2017-2018 | ||
* @license http://www.gnu.org/licenses/gpl.html General Public License | ||
* | ||
* Class for handling file type configuration. | ||
|
@@ -48,7 +48,8 @@ class Application_Controller_Action_Helper_FileTypes extends Application_Control | |
* | ||
* @return mixed | ||
*/ | ||
public function getValidMimeTypes() { | ||
public function getValidMimeTypes() | ||
{ | ||
if (is_null($this->_validMimeTypes)) | ||
{ | ||
|
||
|
@@ -72,6 +73,50 @@ public function getValidMimeTypes() { | |
return $this->_validMimeTypes; | ||
} | ||
|
||
/** | ||
* Checks if a MIME-type is allowed for OPUS 4 files. | ||
* | ||
* @param $mimeType | ||
* @return bool | ||
* | ||
* TODO more efficient method to check? | ||
* TODO differentiate between extension/mime type not allowed or mime type does not match extension | ||
*/ | ||
public function isValidMimeType($mimeType, $extension = null) | ||
{ | ||
$mimeTypes = $this->getValidMimeTypes(); | ||
|
||
if (!is_null($extension)) { | ||
if (isset($mimeTypes[$extension])) { | ||
$mimeTypes = $mimeTypes[$extension]; | ||
} | ||
else { | ||
// unknown extension | ||
return false; | ||
} | ||
|
||
if (is_array($mimeTypes)) { | ||
return in_array($mimeType, $mimeTypes); | ||
} | ||
else { | ||
return $mimeType === $mimeTypes; | ||
} | ||
} | ||
else { | ||
if (in_array($mimeType, $mimeTypes)) { | ||
return true; | ||
} else { | ||
foreach ($mimeTypes as $extension => $types) { | ||
if (is_array($types) && in_array($mimeType, $types)) { | ||
return true; | ||
} | ||
} | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* Returns content disposition for MIME-type used for downloads. | ||
*/ | ||
|
@@ -98,5 +143,4 @@ public function getContentDisposition($mimeType = null) | |
|
||
return $contentDisposition; | ||
} | ||
|
||
} |
Oops, something went wrong.