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

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

00001 <?php
00015 import('classes.security.authorization.internal.MonographFileBaseAccessPolicy');
00016 
00017 class MonographFileUploaderAccessPolicy extends MonographFileBaseAccessPolicy {
00022    function MonographFileUploaderAccessPolicy(&$request, $fileIdAndRevision = null) {
00023       parent::MonographFileBaseAccessPolicy($request, $fileIdAndRevision);
00024    }
00025 
00026 
00027    //
00028    // Implement template methods from AuthorizationPolicy
00029    //
00033    function effect() {
00034       $request =& $this->getRequest();
00035 
00036       // Get the user
00037       $user =& $request->getUser();
00038       if (!is_a($user, 'PKPUser')) return AUTHORIZATION_DENY;
00039 
00040       // Get the monograph file
00041       $monographFile =& $this->getMonographFile($request);
00042       if (!is_a($monographFile, 'MonographFile')) return AUTHORIZATION_DENY;
00043 
00044       // Check if the uploader is the current user.
00045       if ($monographFile->getUploaderUserId() == $user->getId()) {
00046          return AUTHORIZATION_PERMIT;
00047       } else {
00048          return AUTHORIZATION_DENY;
00049       }
00050    }
00051 }
00052 
00053 ?>

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