OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Create a new role in OJS

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.

Create a new role in OJS

Postby Citein » Fri Oct 19, 2012 6:05 am

Hello!!

We use OJS in our institution and we need to create a new Role in OJS which can have access like a "Super User". What I mean is a user that can have access like Administrator, Journal Manager and Editor at the same time.

It is possible to create this kind of role?

Thank you very much in advance for your support.

Lorena
Citein
 
Posts: 7
Joined: Mon Apr 25, 2011 7:58 am

Re: Create a new role in OJS

Postby asmecher » Fri Oct 19, 2012 6:37 am

Hi Lorena,

Users can have multiple roles, so it's already possible for a user to have Site Admin, Journal Manager, and Editor roles. The latter two can be assigned as usual through User Management; you'll need to manually INSERT additional Site Administration roles in your database, though. (I believe instructions for that are available in our FAQ.)

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8307
Joined: Wed Aug 10, 2005 12:56 pm

Re: Create a new role in OJS

Postby Citein » Wed Oct 24, 2012 4:52 am

Dear Alec,

Thank you very much for your answer! I found the information you mentioned in the FAQ.

Regards,

Lorena
Citein
 
Posts: 7
Joined: Mon Apr 25, 2011 7:58 am

Re: Create a new role in OJS

Postby amird » Fri Jul 26, 2013 6:08 pm

Hi
I have same problem, but I can't find mentioned tip in FAQ, could give me direct link?
And is it possible to have a copy of a role (like Editors) with others name (like: Editors1, Editors2, etc.)

Thanks

Best regards
Amir
amird
 
Posts: 21
Joined: Fri Jul 26, 2013 6:03 pm

Re: Create a new role in OJS

Postby asmecher » Sun Jul 28, 2013 8:09 am

Hi Amir,

With OJS 2.x this would require a lot of development. However, OJS 3.0 will have the ability to do what you want; we'll release an early alpha shortly and you can explore it to see if it meets your needs. The roadmap for the 3.0 release is available at http://pkp.sfu.ca/wiki/index.php?title=OJS_Roadmap.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8307
Joined: Wed Aug 10, 2005 12:56 pm

Re: Create a new role in OJS

Postby amird » Sun Jul 28, 2013 8:47 am

Thanks Alec
Sorry for duplicated post, I'm waiting for new version. But is it possible to duplicate an existing role? for example: in OJS we have copyeditor, I need to keep copyeditor role and other role like: technicaleditor with copyeditor permissions.

Regards
Amir
amird
 
Posts: 21
Joined: Fri Jul 26, 2013 6:03 pm

Re: Create a new role in OJS

Postby asmecher » Sun Jul 28, 2013 10:32 pm

Hi Amir,

It's possible -- but would require a fair amount of coding, which would need attention when you later upgraded to 3.0. I wouldn't recommend it.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8307
Joined: Wed Aug 10, 2005 12:56 pm

Re: Create a new role in OJS

Postby amird » Mon Jul 29, 2013 3:46 pm

Hi Alec
Thanks for your quick response
Alec, I have exprience PHP programming for many years and coding is my favorite.
Now, if is it possible for you please give me some information about, what pages and codes must to edit?

Regards
Amir
amird
 
Posts: 21
Joined: Fri Jul 26, 2013 6:03 pm

Re: Create a new role in OJS

Postby asmecher » Mon Jul 29, 2013 4:57 pm

Hi Amir,

Most of the copyeditor-related code is in templates/copyeditor (the Smarty templates), pages/copyeditor (the controller classes), and classes/submission/copyeditor (the model classes). Look in classes/security/Role.inc.php and classes/security/Validation.inc.php for authorization related code and role IDs; look in pages/sectionEditor/SubmissionEditHandler.inc.php, classes/submission/sectionEditor/SectionEditorAction.inc.php and templates/sectionEditor/submission/copyedit.tpl for the Editor's assignment of submissions to copyeditors.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8307
Joined: Wed Aug 10, 2005 12:56 pm

Re: Create a new role in OJS

Postby amird » Tue Jul 30, 2013 5:58 pm

Thanks Alec.
I reviewed all pages that you mantioned and I replace and duplicate many lines of code that I think with them "Technical Editor" role would add to OJS. But actually it wasn't happen!! :(
Is any documentation exists about classes and other methods for reading and developing? or can you help me to add this role to OJS?

Regards
Amir
amird
 
Posts: 21
Joined: Fri Jul 26, 2013 6:03 pm

Re: Create a new role in OJS

Postby asmecher » Tue Jul 30, 2013 8:25 pm

Hi Amir,

The best reference is the OJS Technical Reference, available from the documentation page.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8307
Joined: Wed Aug 10, 2005 12:56 pm

Re: Create a new role in OJS

Postby cristianviza » Fri Sep 27, 2013 10:31 am

Hello asmecher.

I have a similar problem, but I don't want create a new role specifically ( it is quite difficult).
I need view all the item in the manager page when I login "Administrator Master" and when I login "magazine manager" I need view only marked inside the red square:http://subefotos.com/ver/?b700021a17d614512821d2ba09468c3fo.png#codigos.
well, I think modify code in /template/manager/index.tpl ,asking with an if, so just show me the link when it as "administrator master":
for example:
Code: Select all
{if $AdministratorMaster}
   <li>&#187; <a href="{url op="files"}">{translate key="manager.filesBrowser"}</a></li>
{/if}


My question is: what variable in ojs ​​stored values journal_id,user_id,role_id ?, thus be able to know what role I log and use it in the if.
or can I get the values ​​of these var?
Code: Select all
{**
 * index.tpl
 *
 * Copyright (c) 2003-2012 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * Journal management index.
 *
 * $Id$
 *}
{strip}
{assign var="pageTitle" value="manager.journalManagement"}
{include file="common/header.tpl"}
{/strip}
<div id="managementPages">
<h3>{translate key="manager.managementPages"}</h3>
<ul class="plain">
   {if $announcementsEnabled}
      <li>&#187; <a href="{url op="announcements"}">{translate key="manager.announcements"}</a></li>
   {/if}
{if $AdministratorMaster}
   <li>&#187; <a href="{url op="files"}">{translate key="manager.filesBrowser"}</a></li>
{/if}
   <li>&#187; <a href="{url op="sections"}">{translate key="section.sections"}</a></li>
   <li>&#187; <a href="{url op="reviewForms"}">{translate key="manager.reviewForms"}</a></li>
   <li>&#187; <a href="{url op="languages"}">{translate key="common.languages"}</a></li>
   <li>&#187; <a href="{url op="groups"}">{translate key="manager.groups"}</a></li>
   <li>&#187; <a href="{url op="emails"}">{translate key="manager.emails"}</a></li>
   <li>&#187; <a href="{url page="rtadmin"}">{translate key="manager.readingTools"}</a></li>
   <li>&#187; <a href="{url op="setup"}">{translate key="manager.setup"}</a></li>
   <li>&#187; <a href="{url op="statistics"}">{translate key="manager.statistics"}</a></li>
   <!--<li>&#187; <a href="{url op="payments"}">{translate key="manager.payments"}</a></li>-->
   {if $publishingMode == $smarty.const.PUBLISHING_MODE_SUBSCRIPTION}
      <li>&#187; <a href="{url op="subscriptionsSummary"}">{translate key="manager.subscriptions"}</a></li>
   {/if}
   <li>&#187; <a href="{url op="plugins"}">{translate key="manager.plugins"}</a></li>
   <li>&#187; <a href="{url op="importexport"}">{translate key="manager.importExport"}</a></li>
   {call_hook name="Templates::Manager::Index::ManagementPages"}
</ul>
</div>



Regards Cristian
cristianviza
 
Posts: 74
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina

Re: Create a new role in OJS

Postby asmecher » Fri Sep 27, 2013 4:43 pm

Hi Cristian,

The cleanest way to do this (in my opinion) is to query the database in the handler code, then set a variable that the template can use ($AdministratorMaster in your example).

The page that controls the Journal Manager's home is pages/manager/ManagerHandler.inc.php, specifically the "index" function. You can check if the user has the Site Administrator role and assign it to the template by doing something like...
Code: Select all
$user = Request::getUser();
$roleDao =& DAORegistry::getDAO('RoleDAO');
$templateMgr->assign('AdministratorMaster', $roleDao->userHasRole(0, $user->getId(), ROLE_ID_SITE_ADMIN));
Note that $journalId is 0 in the call to $roleDao->userHasRole in this case because the Site Administrator is a site-wide role, not associated with any particular journal.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8307
Joined: Wed Aug 10, 2005 12:56 pm

Re: Create a new role in OJS

Postby cristianviza » Sun Sep 29, 2013 8:53 am

Hello asmecher.

Thanks Very Much :). was exactly I wanted.

added only if someone else serves that in my version of the file ojs don´t exist function userHasRole and I found in : http://pkp.sfu.ca/ojs/doxygen/current/html/RoleDAO_8inc_8php-source.html

Regards Cristian
cristianviza
 
Posts: 74
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron