-
Notifications
You must be signed in to change notification settings - Fork 910
Commit
… OjsJournalMustPublish policy
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* @file classes/security/authorization/OjsAuthorDashboardAccessPolicy.inc.php | ||
This comment has been minimized.
Sorry, something went wrong. |
||
* | ||
* Copyright (c) 2000-2013 John Willinsky | ||
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING. | ||
* | ||
* @class OjsAuthorDashboardAccessPolicy | ||
* @ingroup security_authorization | ||
* | ||
* @brief Class to control access to OMP author dashboard. | ||
*/ | ||
|
||
import('lib.pkp.classes.security.authorization.PolicySet'); | ||
import('lib.pkp.classes.security.authorization.AuthorizationPolicy'); | ||
|
||
class OjsJournalMustPublishPolicy extends AuthorizationPolicy { | ||
|
||
var $_context; | ||
|
||
/** | ||
* Constructor | ||
* @param $request PKPRequest | ||
* @param $args array request arguments | ||
* @param $roleAssignments array | ||
*/ | ||
function OjsJournalMustPublishPolicy($request) { | ||
parent::AuthorizationPolicy('user.authorization.journalDoesNotPublish'); | ||
$this->_context = $request->getContext(); | ||
} | ||
|
||
// | ||
// Implement template methods from AuthorizationPolicy | ||
// | ||
function effect() { | ||
|
||
if (!$this->_context || $this->_context->getSetting('publishingMode') == PUBLISHING_MODE_NONE) { | ||
This comment has been minimized.
Sorry, something went wrong.
bozana
Contributor
|
||
return AUTHORIZATION_DENY; | ||
} | ||
|
||
return AUTHORIZATION_PERMIT; | ||
} | ||
} | ||
?> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,22 @@ function LuceneHandler($request) { | |
parent::Handler(); | ||
$router = $request->getRouter(); | ||
$journal = $router->getContext($request); | ||
$this->addCheck(new HandlerValidatorCustom($this, false, null, null, create_function('$journal', 'return !$journal || $journal->getSetting(\'publishingMode\') != PUBLISHING_MODE_NONE;'), array($journal))); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jnugent
Author
Member
|
||
} | ||
|
||
/** | ||
* @see PKPHandler::authorize() | ||
* @param $request PKPRequest | ||
* @param $args array | ||
* @param $roleAssignments array | ||
*/ | ||
function authorize($request, &$args, $roleAssignments) { | ||
import('lib.pkp.classes.security.authorization.ContextRequiredPolicy'); | ||
$this->addPolicy(new ContextRequiredPolicy($request)); | ||
|
||
import('classes.security.authorization.OjsJournalMustPublishPolicy'); | ||
$this->addPolicy(new OjsJournalMustPublishPolicy($request)); | ||
|
||
return parent::authorize($request, $args, $roleAssignments); | ||
} | ||
|
||
|
||
|
the file name is wrong, should be OjsJournalMustPublishPolicy.inc.php