• Main Page
  • Modules
  • Classes
  • Files
  • File List

classes/security/authorization/internal/MonographFileViewableReviewerResponseRequiredPolicy.inc.php

00001 <?php
00016 import('classes.security.authorization.internal.MonographFileBaseAccessPolicy');
00017 
00018 class MonographFileViewableReviewerResponseRequiredPolicy extends MonographFileBaseAccessPolicy {
00023    function MonographFileViewableReviewerResponseRequiredPolicy(&$request, $fileIdAndRevision = null) {
00024       parent::MonographFileBaseAccessPolicy($request, $fileIdAndRevision);
00025    }
00026 
00027 
00028    //
00029    // Implement template methods from AuthorizationPolicy
00030    //
00034    function effect() {
00035       $request =& $this->getRequest();
00036 
00037       // Get the user
00038       $user =& $request->getUser();
00039       if (!is_a($user, 'PKPUser')) return AUTHORIZATION_DENY;
00040 
00041       // Get the monograph file
00042       $monographFile =& $this->getMonographFile($request);
00043       if (!is_a($monographFile, 'MonographFile')) return AUTHORIZATION_DENY;
00044 
00045       // Make sure that it's in the review stage
00046       if ($monographFile->getFileStage() != MONOGRAPH_FILE_REVIEW_ATTACHMENT) return AUTHORIZATION_DENY;
00047 
00048       // Make sure the file belongs to the monograph in request.
00049       $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
00050       if (!is_a($monograph, 'Monograph')) return AUTHORIZATION_DENY;
00051       if ($monograph->getId() != $monographFile->getSubmissionId()) return AUTHORIZATION_DENY;
00052 
00053       // Make sure the file is visible.
00054       if (!$monographFile->getViewable()) return AUTHORIZATION_DENY;
00055 
00056       // Made it through -- permit access.
00057       return AUTHORIZATION_PERMIT;
00058    }
00059 }
00060 
00061 ?>

Generated on Mon Sep 17 2012 13:58:55 for Open Monograph Press by  doxygen 1.7.1