Hey,
I want to give editors access to the quick submit plugin, but when I look at the code, there appears to be no role validation at all, even the parent class had none, can anyone advise?
Cheers,
Andy
The URL for QuickSubmit is:
index.php/NAME/manager/importexport/plugin/QuickSubmitPlugin
So:
case 'createSubscription':
case 'editSubscription':
case 'updateSubscription':
case 'resetDateReminded':
define('HANDLER_CLASS', 'SubscriptionHandler');
import('pages.manager.SubscriptionHandler');
break;
//
// Import/Export
//
case 'importexport':
define('HANDLER_CLASS', 'ImportExportHandler');
import('pages.manager.ImportExportHandler');
break;
//
// Plugin Management
//
case 'plugins':
case 'plugin':
define('HANDLER_CLASS', 'PluginHandler');
import('pages.manager.PluginHandler');
calls:
function ImportExportHandler() {
parent::ManagerHandler();
}
/**
* Import or export data.
* @param $args array
* @param $request PKPRequest
*/
function importexport($args, &$request) {
$this->validate();
$this->setupTemplate(true);
PluginRegistry::loadCategory(IMPORTEXPORT_PLUGIN_CATEGORY);
$templateMgr =& TemplateManager::getManager();
if (array_shift($args) === 'plugin') {
$pluginName = array_shift($args);
$plugin =& PluginRegistry::getPlugin(IMPORTEXPORT_PLUGIN_CATEGORY, $pluginName);
if ($plugin) return $plugin->display($args, $request);
}
which checks for:
import('pages.manager.ManagerHandler');
class ManagerHandler extends Handler {
/**
* Constructor
**/
function ManagerHandler() {
parent::Handler();
$this->addCheck(new HandlerValidatorJournal($this));
$this->addCheck(new HandlerValidatorRoles($this, true, null, null, array(ROLE_ID_SITE_ADMIN, ROLE_ID_JOURNAL_MANAGER)));
}
/**
* Display journal management index page.
*/
function index() {
$this->validate();
$this->setupTemplate();
$journal =& Request::getJournal();
$templateMgr =& TemplateManager::getManager();
To extend access to Editors, you would need to add a similar handler in pages/editor or override the validation.
Neat, thanks, working nicely.