00001 <?php
00017 import('classes.security.authorization.internal.MonographFileBaseAccessPolicy');
00018
00019 class MonographFileMatchesMonographPolicy extends MonographFileBaseAccessPolicy {
00024 function MonographFileMatchesMonographPolicy(&$request, $fileIdAndRevision = null) {
00025 parent::MonographFileBaseAccessPolicy($request, $fileIdAndRevision);
00026 }
00027
00028
00029
00030
00031
00035 function effect() {
00036
00037 $request =& $this->getRequest();
00038 $monographFile =& $this->getMonographFile($request);
00039 if (!is_a($monographFile, 'MonographFile')) return AUTHORIZATION_DENY;
00040
00041
00042 $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
00043 if (!is_a($monograph, 'Monograph')) return AUTHORIZATION_DENY;
00044
00045
00046 if ($monographFile->getMonographId() == $monograph->getId()) {
00047
00048 $monographFilesArray = $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH_FILES);
00049 if (is_null($monographFilesArray)) {
00050 $monographFilesArray = array();
00051 }
00052 array_push($monographFilesArray, $monographFile);
00053 $this->addAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH_FILES, $monographFilesArray);
00054
00055
00056 $this->addAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH_FILE, $monographFile);
00057 return AUTHORIZATION_PERMIT;
00058 } else {
00059 return AUTHORIZATION_DENY;
00060 }
00061 }
00062 }
00063
00064 ?>