forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
11167-Cambios para subida de SediciAdmin
- Loading branch information
1 parent
b077208
commit 8a5335a
Showing
5 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...ava/ar/edu/unlp/sedici/dspace/xmlworkflow/state/actions/userassignment/SelectIfAdmin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* The contents of this file are subject to the license and copyright | ||
* detailed in the LICENSE and NOTICE files at the root of the source | ||
* tree and available online at | ||
* | ||
* http://www.dspace.org/license/ | ||
*/ | ||
package ar.edu.unlp.sedici.dspace.xmlworkflow.state.actions.userassignment; | ||
|
||
import org.dspace.authorize.AuthorizeException; | ||
import org.dspace.core.*; | ||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; | ||
import org.dspace.xmlworkflow.*; | ||
import org.dspace.xmlworkflow.state.Step; | ||
import org.dspace.xmlworkflow.state.actions.userassignment.ClaimAction; | ||
import ar.edu.unlp.sedici.util.AuthorizeUtil; | ||
|
||
import java.io.IOException; | ||
import java.sql.SQLException; | ||
|
||
/** | ||
* Processing class for an action where x number of users | ||
* have to accept a task from a designated pool | ||
* | ||
* @author Bram De Schouwer (bram.deschouwer at dot com) | ||
* @author Kevin Van de Velde (kevin at atmire dot com) | ||
* @author Ben Bosman (ben at atmire dot com) | ||
* @author Mark Diggory (markd at atmire dot com) | ||
*/ | ||
public class SelectIfAdmin extends ClaimAction { | ||
|
||
@Override | ||
public boolean isValidUserSelection(Context context, XmlWorkflowItem wfi, boolean hasUI) throws WorkflowConfigurationException, SQLException { | ||
//A user claim action always needs to have a UI, since somebody needs to be able to claim it | ||
if(hasUI){ | ||
if (AuthorizeUtil.epersonInGroup(context, 2 ,context.getCurrentUser())||AuthorizeUtil.epersonInGroup(context, 1 ,context.getCurrentUser())) { | ||
return true; | ||
} | ||
return super.isValidUserSelection(context, wfi, hasUI); | ||
}else | ||
return true; | ||
|
||
} | ||
|
||
@Override | ||
public void activate(Context context, XmlWorkflowItem wfItem) throws SQLException, IOException, AuthorizeException { | ||
Step owningStep = getParent().getStep(); | ||
// Create pooled tasks for the Sedici Submitter | ||
if (AuthorizeUtil.epersonInGroup(context, 2 ,context.getCurrentUser())||AuthorizeUtil.epersonInGroup(context, 1 ,context.getCurrentUser())){ | ||
RoleMembers rol = new RoleMembers(); | ||
rol.addEPerson(context.getCurrentUser()); | ||
XmlWorkflowManager.createPoolTasks(context, wfItem, rol, owningStep, getParent()); | ||
alertUsersOnActivation(context, wfItem, rol); | ||
} | ||
else | ||
super.activate(context, wfItem); | ||
|
||
|
||
} | ||
|
||
} |