Skip to content

Commit

Permalink
11167-Cambios para subida de SediciAdmin
Browse files Browse the repository at this point in the history
  • Loading branch information
GarrafaGalactica committed Oct 25, 2024
1 parent b077208 commit 8a5335a
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 3 deletions.
3 changes: 1 addition & 2 deletions dspace/config/input-forms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1240,10 +1240,9 @@
<dc-element>creator</dc-element>
<dc-qualifier>person</dc-qualifier>
<repeatable>true</repeatable>
<label>Autor (*)</label>
<label>Autor</label>
<input-type>onebox</input-type>
<hint>Autores de la obra</hint>
<required>Debe indicarse el/los autores de la obra</required>
<type-bind>!Objeto Fisico</type-bind>
</field>
<field> <!-- Ok --> <!-- Duplicado para Red de Museos -->
Expand Down
7 changes: 7 additions & 0 deletions dspace/config/spring/api/workflow-actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">

<bean id="claimactionAPI" class="org.dspace.xmlworkflow.state.actions.userassignment.ClaimAction" scope="prototype"/>
<bean id="selectIfAdminAPI" class="ar.edu.unlp.sedici.dspace.xmlworkflow.state.actions.userassignment.SelectIfAdmin" scope="prototype"/>
<bean id="reviewactionAPI" class="org.dspace.xmlworkflow.state.actions.processingaction.ReviewAction" scope="prototype"/>
<bean id="editactionAPI" class="org.dspace.xmlworkflow.state.actions.processingaction.AcceptEditRejectAction" scope="prototype"/>
<bean id="finaleditactionAPI" class="org.dspace.xmlworkflow.state.actions.processingaction.FinalEditAction" scope="prototype"/>
Expand Down Expand Up @@ -101,6 +102,12 @@
<property name="requiresUI" value="true"/>
</bean>

<bean id="selectIfAdmin" class="org.dspace.xmlworkflow.state.actions.UserSelectionActionConfig" scope="prototype">
<constructor-arg type="java.lang.String" value="selectIfAdmin"/>
<property name="processingAction" ref="selectIfAdminAPI"/>
<property name="requiresUI" value="true"/>
</bean>

<bean id="autoassignAction" class="org.dspace.xmlworkflow.state.actions.UserSelectionActionConfig" scope="prototype">
<constructor-arg type="java.lang.String" value="autoassignAction"/>
<property name="processingAction" ref="autoassignactionAPI"/>
Expand Down
1 change: 1 addition & 0 deletions dspace/config/spring/xmlui/workflow-actions-xmlui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<bean id="scorereviewaction_xmlui" class="org.dspace.app.xmlui.aspect.xmlworkflow.actions.processingaction.ScoreReviewAction" scope="singleton"/>

<bean id="selectcollectionaction_xmlui" class="ar.edu.unlp.sedici.aspect.extraSubmission.SeDiCISelectCollectionAction" scope="singleton"/>
<bean id="selectIfAdmin_xmlui" class="org.dspace.app.xmlui.aspect.xmlworkflow.actions.userassignment.ClaimAction" scope="singleton"/>

<bean id="skipadminclaimaction_xmlui" class="org.dspace.app.xmlui.aspect.xmlworkflow.actions.userassignment.ClaimAction" scope="singleton"/>
<bean id="acceptRoleOrNotAdmin_xmlui" class="org.dspace.app.xmlui.aspect.xmlworkflow.actions.userassignment.ClaimAction" scope="singleton"/>
Expand Down
2 changes: 1 addition & 1 deletion dspace/config/workflow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<role id="Admin" name="Admin" scope="collection" description="Este paso le permite a un administrador de una coleccion, editar los metadatos y aceptar o rechazar el envío"/>
</roles>

<step id="CollectionLevelReview" role="Admin" userSelectionMethod="claimaction">
<step id="CollectionLevelReview" role="Admin" userSelectionMethod="selectIfAdmin">
<actions>
<action id="editaction"/>
</actions>
Expand Down
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);


}

}

0 comments on commit 8a5335a

Please sign in to comment.