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