OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Modification of Function applications

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Modification of Function applications

Postby apsc » Thu Mar 16, 2006 9:57 am

I am currently trying to include "file browsing" rights to my editor. Or lets just say I am "playing" around with the options where each role is assigned to.

Is there an area or file which states the different access of functions to each individual? I have tried manual overwriting of codes from the manager to the editor but apparently there are issues as their respective functions reside in different directories/domains. So I am wondering if there are any files which assign the function rights to each domain

PatriX
apsc
 
Posts: 18
Joined: Mon Mar 06, 2006 2:56 am

Postby asmecher » Thu Mar 16, 2006 10:44 am

Hi apsc,

The security validation happens in the Handler classes; for example, see pages/manager/FilesHandler.inc.php for the Files Browser functions. At the beginning of every function, there's a call to the parent class's validation function:
Code: Select all
parent::validate();
If you look at the parent class, in pages/manager/ManagerHandler.inc.php, you'll see the implementation of the validate() function:
Code: Select all
/**
 * Validate that user has permissions to manage the selected journal.
 * Redirects to user index page if not properly authenticated.
 */
function validate() {
        parent::validate();
        $journal =& Request::getJournal();
        if (!$journal || (!Validation::isJournalManager() && !Validation::isSiteAdmin())) {
                Validation::redirectLogin();
        }
}
This checks to ensure that the user is browsing a particular journal, and that they've got Journal Manager or Site Administrator rights.

The easiest way to give Files Browser functions to Editors is to copy this code into FilesHandler.inc.php, change it to allow editors as well (see the Validation class), and change all calls in FilesHandler.inc.php to the validation function from:
Code: Select all
parent::validate();
to:
Code: Select all
FilesHandler::validate();
.

If you're looking for a reference to the OJS source code, see the Technical Reference at http://pkp.sfu.ca/ojs/OJSTechnicalReference.pdf.

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 7717
Joined: Wed Aug 10, 2005 12:56 pm

Register of Section Editor

Postby apsc » Sun Mar 19, 2006 9:03 pm

During the registration of the users, instead of readers, authors and reviewers, I hope to be able to inculcate registration of users as section editors due to my system requirements.

register.tpl - the main html codings for the register page. Is it possible with addition of codes and amendments to the subsqeuent pages to register a user as a section editor? How? please enlighten, thanks!
apsc
 
Posts: 18
Joined: Mon Mar 06, 2006 2:56 am

Postby asmecher » Mon Mar 20, 2006 9:58 am

Hi apsc,

It is possible to accomplish this; in templates/user/register.tpl, at line 127 (in OJS 2.1.0-1), you can add the following line below the reviewer registration:
Code: Select all
<input type="checkbox" name="registerAsSectionEditor" id="registerAsSectionEditor" value="1"{if $registerAsSectionEditor} checked="checked"{/if} /> <label for="registerAsSectionEditor">{translate key="user.role.sectionEditor"}</label>: {translate key="user.register.sectionEditorDescription"}<br />
You'll need to add the user.register.sectionEditorDescription locale key (using the user.register.authorDescription key as an example).

Then you'll need to add the appropriate code to classes/user/form/RegistrationForm.inc.php.
  • Add 'registerAsSectionEditor' to the list of variables at the beginning of the readInputData function;
  • Add 'sectionEditor' => 'registerAsSectionEditor' to $allowedRoles (line 192);
These code modifications have not been tested, but should provide the general idea.

However, please note that Section Editors have a great deal of power in OJS and you may want to be cautious about allowing them to register without Journal Manager intervention.

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 7717
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: No registered users and 4 guests