Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
SubmissionFileSubmissionStageRequiredPolicy.inc.php
1 <?php
16 import('lib.pkp.classes.security.authorization.internal.SubmissionFileBaseAccessPolicy');
17 
23  function SubmissionFileSubmissionStageRequiredPolicy($request, $fileIdAndRevision = null) {
24  parent::SubmissionFileBaseAccessPolicy($request, $fileIdAndRevision);
25  }
26 
27 
28  //
29  // Implement template methods from AuthorizationPolicy
30  //
34  function effect() {
35  $request = $this->getRequest();
36 
37  // Get the submission file.
38  $submissionFile = $this->getSubmissionFile($request);
39  if (!is_a($submissionFile, 'SubmissionFile')) return AUTHORIZATION_DENY;
40 
41  // Make sure that it's in the submission stage
42  if ($submissionFile->getFileStage() != SUBMISSION_FILE_SUBMISSION) return AUTHORIZATION_DENY;
43 
44  // Make sure the file belongs to the submission in request.
45  $submission =& $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
46  if (!is_a($submission, 'Submission')) return AUTHORIZATION_DENY;
47  if ($submission->getId() != $submissionFile->getSubmissionId()) return AUTHORIZATION_DENY;
48 
49  // Made it through -- permit access.
50  return AUTHORIZATION_PERMIT;
51  }
52 }
53 
54 ?>
Submission file policy to ensure that we have a file at submission stage.
& getAuthorizedContextObject($assocType)
Abstract class for submission file access policies.