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

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

00001 <?php
00015 import('lib.pkp.classes.security.authorization.AuthorizationPolicy');
00016 
00017 class SignoffAssignedToUserAccessPolicy extends AuthorizationPolicy {
00019    var $_request;
00020 
00025    function SignoffAssignedToUserAccessPolicy(&$request) {
00026       parent::AuthorizationPolicy('user.authorization.monographSignoff');
00027       $this->_request =& $request;
00028    }
00029 
00030    //
00031    // Implement template methods from AuthorizationPolicy
00032    //
00036    function effect() {
00037       // A signoff should already be in the context.
00038       $signoff =& $this->getAuthorizedContextObject(ASSOC_TYPE_SIGNOFF);
00039       if (!is_a($signoff, 'Signoff')) return AUTHORIZATION_DENY;
00040 
00041       // Check that there is a currently logged in user.
00042       $user =& $this->_request->getUser();
00043       if (!is_a($user, 'User')) return AUTHORIZATION_DENY;
00044 
00045       // Check if the signoff is assigned to the user.
00046       if ($signoff->getUserId() == $user->getUserId()) return AUTHORIZATION_PERMIT;
00047 
00048       // Otherwise, deny.
00049       return AUTHORIZATION_DENY;
00050    }
00051 }
00052 
00053 ?>

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