mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
112545: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3) 112271: Merged DEV to V4.2-BUG-FIX (4.2.6) 111087: MNT-11957 - move approveModeratedInvitation to InvitationService so its auditable 111792: MNT-11957: Approving a request to join site not available for auditing - move rejectModeratedInvitation to InvitationService so its auditable 111854: MNT-11957: Approving a request to join site not available for auditing - move acceptNominatedInvitation and cancelInvitation to InvitationService so its auditable 111890: MNT-11957: Approving a request to join site not available for auditing - Removed obsolete methods from InviteHelper 111991: MNT-11957: Approving a request to join site not available for auditing - move deleteAuthenticationIfUnused and sendNominatedInvitationto InvitationService so its auditable. Excluded InviteHelper. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@112558 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,6 +24,10 @@
|
||||
<property name="nominatedInvitationWorkflowId" value="${site.invite.nominated.workflowId}"/>
|
||||
<property name="nominatedInvitationExternalWorkflowId" value="${site.invite.nominatedExternal.workflowId}"/>
|
||||
<property name="moderatedInvitationWorkflowId" value="${site.invite.moderated.workflowId}"/>
|
||||
<property name="templateService" ref="templateService"/>
|
||||
<property name="serviceRegistry" ref="ServiceRegistry"/>
|
||||
<property name="repositoryHelper" ref="repositoryHelper"/>
|
||||
<property name="messageService" ref="messageService"/>
|
||||
</bean>
|
||||
|
||||
<!-- Site service security bean -->
|
||||
@@ -78,16 +82,10 @@
|
||||
<property name="siteService" ref="SiteService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="InviteHelper" class="org.alfresco.repo.invitation.InviteHelper">
|
||||
<property name="serviceRegistry" ref="ServiceRegistry"/>
|
||||
<property name="repositoryHelper" ref="repositoryHelper"/>
|
||||
<property name="messageService" ref="messageService"/>
|
||||
</bean>
|
||||
|
||||
<!-- Activiti Workflow Delegate beans -->
|
||||
<bean id="baseInvitationDelegate" parent="baseJavaDelegate"
|
||||
class="org.alfresco.repo.invitation.activiti.AbstractInvitationDelegate" abstract="true">
|
||||
<property name="inviteHelper" ref="InviteHelper" />
|
||||
<property name="invitationService" ref="InvitationService" />
|
||||
</bean>
|
||||
|
||||
<bean id="AcceptNominatedInviteDelegate" parent="baseInvitationDelegate"
|
||||
|
@@ -19,9 +19,20 @@
|
||||
|
||||
package org.alfresco.repo.invitation;
|
||||
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarAcceptUrl;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarInviteTicket;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarInviteeGenPassword;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarInviteeUserName;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarInviterUserName;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarRejectUrl;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarResourceName;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarRole;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarServerPath;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -31,7 +42,13 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.action.executer.MailActionExecuter;
|
||||
import org.alfresco.repo.admin.SysAdminParams;
|
||||
import org.alfresco.repo.i18n.MessageService;
|
||||
import org.alfresco.repo.invitation.activiti.SendNominatedInviteDelegate;
|
||||
import org.alfresco.repo.invitation.site.InviteSender;
|
||||
import org.alfresco.repo.jscript.ScriptNode;
|
||||
import org.alfresco.repo.model.Repository;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy;
|
||||
import org.alfresco.repo.policy.JavaBehaviour;
|
||||
@@ -47,6 +64,7 @@ import org.alfresco.repo.workflow.CancelWorkflowActionExecuter;
|
||||
import org.alfresco.repo.workflow.WorkflowModel;
|
||||
import org.alfresco.repo.workflow.activiti.ActivitiConstants;
|
||||
import org.alfresco.repo.workflow.jbpm.JBPMEngine;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
@@ -63,6 +81,7 @@ import org.alfresco.service.cmr.invitation.ModeratedInvitation;
|
||||
import org.alfresco.service.cmr.invitation.NominatedInvitation;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.TemplateService;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
@@ -98,6 +117,20 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
public class InvitationServiceImpl implements InvitationService, NodeServicePolicies.BeforeDeleteNodePolicy
|
||||
{
|
||||
private static final Log logger = LogFactory.getLog(InvitationServiceImpl.class);
|
||||
private static final String REJECT_TEMPLATE = "/alfresco/bootstrap/invite/moderated-reject-email.ftl";
|
||||
private static final String MSG_NOT_SITE_MANAGER = "invitation.cancel.not_site_manager";
|
||||
private static final Collection<String> sendInvitePropertyNames = Arrays.asList(wfVarInviteeUserName,//
|
||||
wfVarResourceName,//
|
||||
wfVarInviterUserName,//
|
||||
wfVarInviteeUserName,//
|
||||
wfVarRole,//
|
||||
wfVarInviteeGenPassword,//
|
||||
wfVarResourceName,//
|
||||
wfVarInviteTicket,//
|
||||
wfVarServerPath,//
|
||||
wfVarAcceptUrl,//
|
||||
wfVarRejectUrl,
|
||||
InviteSender.WF_INSTANCE_ID);
|
||||
|
||||
/**
|
||||
* Services
|
||||
@@ -117,6 +150,11 @@ public class InvitationServiceImpl implements InvitationService, NodeServicePoli
|
||||
private PasswordGenerator passwordGenerator;
|
||||
private PolicyComponent policyComponent;
|
||||
private SysAdminParams sysAdminParams;
|
||||
private TemplateService templateService;
|
||||
private Repository repositoryHelper;
|
||||
private ServiceRegistry serviceRegistry;
|
||||
private MessageService messageService;
|
||||
private InviteSender inviteSender;
|
||||
|
||||
// maximum number of tries to generate a invitee user name which
|
||||
// does not already belong to an existing person
|
||||
@@ -196,6 +234,9 @@ public class InvitationServiceImpl implements InvitationService, NodeServicePoli
|
||||
PropertyCheck.mandatory(this, "UserNameGenerator", usernameGenerator);
|
||||
PropertyCheck.mandatory(this, "PasswordGenerator", passwordGenerator);
|
||||
PropertyCheck.mandatory(this, "PolicyComponent", policyComponent);
|
||||
PropertyCheck.mandatory(this, "templateService", templateService);
|
||||
|
||||
this.inviteSender = new InviteSender(serviceRegistry, repositoryHelper, messageService);
|
||||
|
||||
//
|
||||
this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"),
|
||||
@@ -1760,4 +1801,221 @@ public class InvitationServiceImpl implements InvitationService, NodeServicePoli
|
||||
{
|
||||
this.sysAdminParams = sysAdminParams;
|
||||
}
|
||||
|
||||
public void setTemplateService(TemplateService templateService)
|
||||
{
|
||||
this.templateService = templateService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param messageService the messageService to set
|
||||
*/
|
||||
public void setMessageService(MessageService messageService)
|
||||
{
|
||||
this.messageService = messageService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param repositoryHelper the repositoryHelper to set
|
||||
*/
|
||||
public void setRepositoryHelper(Repository repositoryHelper)
|
||||
{
|
||||
this.repositoryHelper = repositoryHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param serviceRegistry the serviceRegistry to set
|
||||
*/
|
||||
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptNominatedInvitation(String siteName, final String invitee, String role, String inviter)
|
||||
{
|
||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||
{
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
if (authenticationService.isAuthenticationMutable(invitee))
|
||||
{
|
||||
authenticationService.setAuthenticationEnabled(invitee, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
addSiteMembership(invitee, siteName, role, inviter, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void approveModeratedInvitation(String siteName, String invitee, String role, String reviewer)
|
||||
{
|
||||
addSiteMembership(invitee, siteName, role, reviewer, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Invitee to Site with the site role that the inviter "started" the invite process with
|
||||
* @param invitee
|
||||
* @param siteName
|
||||
* @param role
|
||||
* @param runAsUser
|
||||
* @param siteService
|
||||
* @param overrideExisting
|
||||
*/
|
||||
public void addSiteMembership(final String invitee, final String siteName, final String role, final String runAsUser, final boolean overrideExisting)
|
||||
{
|
||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||
{
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
if (overrideExisting || !siteService.isMember(siteName, invitee))
|
||||
{
|
||||
siteService.setMembership(siteName, invitee, role);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}, runAsUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rejectModeratedInvitation(String siteName, String invitee, String role, String reviewer, String resourceType, String reviewComments)
|
||||
{
|
||||
// Do nothing if emails disabled.
|
||||
if (isSendEmails() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// send email to the invitee if possible - but don't fail the rejection if email cannot be sent
|
||||
try
|
||||
{
|
||||
// Build our model
|
||||
Map<String, Serializable> model = new HashMap<String, Serializable>(8, 1.0f);
|
||||
model.put("resourceName", siteName);
|
||||
model.put("resourceType", resourceType);
|
||||
model.put("inviteeRole", role);
|
||||
model.put("reviewComments", reviewComments);
|
||||
model.put("reviewer", reviewer);
|
||||
model.put("inviteeUserName", invitee);
|
||||
|
||||
// Process the template
|
||||
// Note - because we use a classpath template, rather than a Data Dictionary
|
||||
// one, we can't have the MailActionExecutor do the template for us
|
||||
String emailMsg = templateService.processTemplate("freemarker", REJECT_TEMPLATE, model);
|
||||
|
||||
// Send
|
||||
Action emailAction = actionService.createAction("mail");
|
||||
emailAction.setParameterValue(MailActionExecuter.PARAM_TO, nodeService.getProperty(personService.getPerson(invitee), ContentModel.PROP_EMAIL));
|
||||
emailAction.setParameterValue(MailActionExecuter.PARAM_FROM, nodeService.getProperty(personService.getPerson(reviewer), ContentModel.PROP_EMAIL));
|
||||
// TODO Localize this.
|
||||
emailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, "Rejected invitation to web site:" + siteName);
|
||||
emailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, emailMsg);
|
||||
emailAction.setExecuteAsynchronously(true);
|
||||
actionService.executeAction(emailAction, null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Swallow exception
|
||||
logger.error("unable to send reject email", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAuthenticationIfUnused(final String invitee, final String currentInviteId)
|
||||
{
|
||||
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
{
|
||||
// see if there are any pending invites (invite workflow instances with invitePending task in-progress)
|
||||
// outstanding for given invitee user name
|
||||
List<Invitation> pendingInvites = listPendingInvitationsForInvitee(invitee);
|
||||
boolean invitesPending = CollectionUtils.isEmpty(pendingInvites)==false;
|
||||
if (invitesPending && pendingInvites.size() == 1)
|
||||
{
|
||||
Invitation pendingInvite = pendingInvites.get(0);
|
||||
if (pendingInvite.getInviteId().equals(currentInviteId))
|
||||
{
|
||||
invitesPending = false;
|
||||
}
|
||||
}
|
||||
|
||||
NodeRef person = personService.getPersonOrNull(invitee);
|
||||
|
||||
// if invitee's user account is still disabled and there are no pending invites outstanding
|
||||
// for the invitee, then remove the account and delete the invitee's person node
|
||||
if (person != null
|
||||
&& (authenticationService.isAuthenticationMutable(invitee))
|
||||
&& (authenticationService.getAuthenticationEnabled(invitee) == false)
|
||||
&& (invitesPending == false)
|
||||
&& nodeService.hasAspect(person, ContentModel.ASPECT_ANULLABLE))
|
||||
{
|
||||
// delete the invitee's user account
|
||||
authenticationService.deleteAuthentication(invitee);
|
||||
|
||||
// delete the invitee's person node if one exists
|
||||
if (personService.personExists(invitee))
|
||||
{
|
||||
personService.deletePerson(invitee);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendNominatedInvitation(String inviteId, Map<String, Object> executionVariables)
|
||||
{
|
||||
sendNominatedInvitation(
|
||||
inviteId, SendNominatedInviteDelegate.EMAIL_TEMPLATE_XPATH, SendNominatedInviteDelegate.EMAIL_SUBJECT_KEY, executionVariables);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendNominatedInvitation(String inviteId, String emailTemplateXpath,
|
||||
String emailSubjectKey, Map<String, Object> executionVariables)
|
||||
{
|
||||
if (isSendEmails())
|
||||
{
|
||||
Map<String, String> properties = makePropertiesFromContextVariables(executionVariables, sendInvitePropertyNames);
|
||||
|
||||
String packageName = WorkflowModel.ASSOC_PACKAGE.toPrefixString(namespaceService).replace(":", "_");
|
||||
ScriptNode packageNode = (ScriptNode) executionVariables.get(packageName);
|
||||
String packageRef = packageNode.getNodeRef().toString();
|
||||
properties.put(InviteSender.WF_PACKAGE, packageRef);
|
||||
|
||||
properties.put(InviteSender.WF_INSTANCE_ID, inviteId);
|
||||
|
||||
inviteSender.sendMail(emailTemplateXpath, emailSubjectKey, properties);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelInvitation(String siteName, String invitee, String inviteId, String currentInviteId)
|
||||
{
|
||||
if (!AuthenticationUtil.isRunAsUserTheSystemUser())
|
||||
{
|
||||
String currentUserName = authenticationService.getCurrentUserName();
|
||||
String currentUserSiteRole = siteService.getMembersRole(siteName, currentUserName);
|
||||
if (SiteModel.SITE_MANAGER.equals(currentUserSiteRole)== false)
|
||||
{
|
||||
// The current user is not the site manager
|
||||
Object[] args = {currentUserName, inviteId, siteName};
|
||||
throw new InvitationExceptionForbidden(MSG_NOT_SITE_MANAGER, args);
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up invitee's user account and person node if they are not in use i.e.
|
||||
// account is still disabled and there are no pending invites outstanding for the
|
||||
// invitee
|
||||
deleteAuthenticationIfUnused(invitee, currentInviteId);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<String, String> makePropertiesFromContextVariables(Map<?, ?> executionVariables, Collection<String> propertyNames)
|
||||
{
|
||||
return CollectionUtils.filterKeys((Map<String, String>) executionVariables, CollectionUtils.containsFilter(propertyNames));
|
||||
}
|
||||
}
|
||||
|
@@ -1,468 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.invitation;
|
||||
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.WF_TASK_ACTIVIT_INVITE_PENDING;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.WF_TASK_INVITE_PENDING;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarAcceptUrl;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarInviteTicket;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarInviteeGenPassword;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarInviteeUserName;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarInviterUserName;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarRejectUrl;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarResourceName;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarRole;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarServerPath;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarWorkflowInstanceId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.action.executer.MailActionExecuter;
|
||||
import org.alfresco.repo.i18n.MessageService;
|
||||
import org.alfresco.repo.invitation.activiti.SendNominatedInviteDelegate;
|
||||
import org.alfresco.repo.invitation.site.InviteInfo;
|
||||
import org.alfresco.repo.invitation.site.InviteSender;
|
||||
import org.alfresco.repo.jscript.ScriptNode;
|
||||
import org.alfresco.repo.model.Repository;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.site.SiteModel;
|
||||
import org.alfresco.repo.template.TemplateNode;
|
||||
import org.alfresco.repo.workflow.WorkflowModel;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.invitation.Invitation;
|
||||
import org.alfresco.service.cmr.invitation.InvitationExceptionForbidden;
|
||||
import org.alfresco.service.cmr.invitation.InvitationService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.TemplateService;
|
||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.site.SiteInfo;
|
||||
import org.alfresco.service.cmr.site.SiteService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTaskState;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.collections.CollectionUtils;
|
||||
import org.alfresco.util.collections.Filter;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
/**
|
||||
* Helper class to house utility methods common to
|
||||
* more than one Invite Service Web Script
|
||||
*
|
||||
* @author Nick Smith
|
||||
*/
|
||||
public class InviteHelper implements InitializingBean
|
||||
{
|
||||
public final static String NAME = "InviteHelper";
|
||||
private final static String MSG_NOT_SITE_MANAGER = "invitation.cancel.not_site_manager";
|
||||
private static final String REJECT_TEMPLATE = "/alfresco/bootstrap/invite/moderated-reject-email.ftl";
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ModeratedActionReject.class);
|
||||
|
||||
private static final Collection<String> sendInvitePropertyNames = Arrays.asList(wfVarInviteeUserName,//
|
||||
wfVarResourceName,//
|
||||
wfVarInviterUserName,//
|
||||
wfVarInviteeUserName,//
|
||||
wfVarRole,//
|
||||
wfVarInviteeGenPassword,//
|
||||
wfVarResourceName,//
|
||||
wfVarInviteTicket,//
|
||||
wfVarServerPath,//
|
||||
wfVarAcceptUrl,//
|
||||
wfVarRejectUrl,
|
||||
InviteSender.WF_INSTANCE_ID);
|
||||
|
||||
private Repository repositoryHelper;
|
||||
private ServiceRegistry serviceRegistry;
|
||||
|
||||
private ActionService actionService;
|
||||
private InvitationService invitationService;
|
||||
private MutableAuthenticationService authenticationService;
|
||||
private MessageService messageService;
|
||||
private NamespaceService namespaceService;
|
||||
private PersonService personService;
|
||||
private SiteService siteService;
|
||||
private TemplateService templateService;
|
||||
private WorkflowService workflowService;
|
||||
private NodeService nodeService;
|
||||
|
||||
private InviteSender inviteSender;
|
||||
|
||||
public void afterPropertiesSet()
|
||||
{
|
||||
this.actionService = serviceRegistry.getActionService();
|
||||
this.authenticationService =serviceRegistry.getAuthenticationService();
|
||||
this.invitationService = serviceRegistry.getInvitationService();
|
||||
this.namespaceService = serviceRegistry.getNamespaceService();
|
||||
this.personService = serviceRegistry.getPersonService();
|
||||
this.siteService = serviceRegistry.getSiteService();
|
||||
this.templateService = serviceRegistry.getTemplateService();
|
||||
this.workflowService = serviceRegistry.getWorkflowService();
|
||||
this.nodeService = serviceRegistry.getNodeService();
|
||||
this.inviteSender = new InviteSender(serviceRegistry, repositoryHelper, messageService);
|
||||
}
|
||||
|
||||
public void acceptNominatedInvitation(Map<String, Object> executionVariables)
|
||||
{
|
||||
final String invitee = (String) executionVariables.get(WorkflowModelNominatedInvitation.wfVarInviteeUserName);
|
||||
String siteShortName = (String) executionVariables.get(WorkflowModelNominatedInvitation.wfVarResourceName);
|
||||
String inviter = (String) executionVariables.get(WorkflowModelNominatedInvitation.wfVarInviterUserName);
|
||||
String role = (String) executionVariables.get(WorkflowModelNominatedInvitation.wfVarRole);
|
||||
|
||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||
{
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
if (authenticationService.isAuthenticationMutable(invitee))
|
||||
{
|
||||
authenticationService.setAuthenticationEnabled(invitee, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
addSiteMembership(invitee, siteShortName, role, inviter, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find an invite start task by the given task id.
|
||||
*
|
||||
* @return a WorkflowTask or null if not found.
|
||||
*/
|
||||
public WorkflowTask findInviteStartTask(String inviteId)
|
||||
{
|
||||
return workflowService.getStartTask(inviteId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find invitePending tasks (in-progress) by the given invitee user name
|
||||
*
|
||||
* @return a list of workflow tasks
|
||||
*/
|
||||
public List<WorkflowTask> findInvitePendingTasks(String inviteeUserName)
|
||||
{
|
||||
List<WorkflowTask> tasks = workflowService.getAssignedTasks(inviteeUserName, WorkflowTaskState.IN_PROGRESS);
|
||||
return CollectionUtils.filter(tasks, new Filter<WorkflowTask>()
|
||||
{
|
||||
public Boolean apply(WorkflowTask value)
|
||||
{
|
||||
QName taskDefName = value.getDefinition().getMetadata().getName();
|
||||
return WF_TASK_INVITE_PENDING.equals(taskDefName) ||
|
||||
WF_TASK_ACTIVIT_INVITE_PENDING.equals(taskDefName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an InviteInfo instance for the given startInvite task
|
||||
* (used for rendering the response).
|
||||
*
|
||||
* @param startInviteTask startInvite task to get invite info properties from
|
||||
* @return InviteInfo instance containing invite information
|
||||
*/
|
||||
public InviteInfo getPendingInviteInfo(WorkflowTask startInviteTask)
|
||||
{
|
||||
Map<QName, Serializable> taskProps = startInviteTask.getProperties();
|
||||
// get the inviter, invitee, role and site short name
|
||||
String inviterUserName = (String) taskProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITER_USER_NAME);
|
||||
String inviteeUserName = (String) taskProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_USER_NAME);
|
||||
String role = (String) taskProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_ROLE);
|
||||
String siteShortName = (String) taskProps.get(WorkflowModelNominatedInvitation.WF_PROP_RESOURCE_NAME);
|
||||
|
||||
// get the site info
|
||||
SiteInfo siteInfo = siteService.getSite(siteShortName);
|
||||
|
||||
// get workflow instance id (associated with workflow task) to place
|
||||
// as "inviteId" onto model
|
||||
String workflowId = startInviteTask.getPath().getInstance().getId();
|
||||
|
||||
// set the invite start date to the time the workflow instance
|
||||
// (associated with the task) was started
|
||||
Date sentInviteDate = startInviteTask.getPath().getInstance().getStartDate();
|
||||
|
||||
// TODO: glen johnson at alfresco com - as this web script only returns
|
||||
// pending invites, this is hard coded to "pending" for now
|
||||
String invitationStatus = InviteInfo.INVITATION_STATUS_PENDING;
|
||||
|
||||
// fetch the person node for the inviter
|
||||
NodeRef inviterRef = personService.getPerson(inviterUserName);
|
||||
TemplateNode inviterPerson = inviterRef == null ? null : new TemplateNode(inviterRef, serviceRegistry, null);
|
||||
|
||||
// fetch the person node for the invitee
|
||||
NodeRef inviteeRef = personService.getPerson(inviteeUserName);
|
||||
TemplateNode inviteePerson = inviteeRef == null ? null : new TemplateNode(inviteeRef, serviceRegistry, null);
|
||||
// create and return the invite info
|
||||
return new InviteInfo(invitationStatus,
|
||||
inviterUserName, inviterPerson,
|
||||
inviteeUserName, inviteePerson,
|
||||
role, siteShortName, siteInfo,
|
||||
sentInviteDate, workflowId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Invitee to Site with the site role that the inviter "started" the invite process with
|
||||
* @param invitee String
|
||||
* @param siteName String
|
||||
* @param role String
|
||||
* @param runAsUser String
|
||||
* @param overrideExisting boolean
|
||||
*/
|
||||
public void addSiteMembership(final String invitee, final String siteName, final String role, final String runAsUser, final boolean overrideExisting)
|
||||
{
|
||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||
{
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
if (overrideExisting || !siteService.isMember(siteName, invitee))
|
||||
{
|
||||
siteService.setMembership(siteName, invitee, role);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}, runAsUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up invitee user account and person node when no longer in use.
|
||||
* They are deemed to no longer be in use when the invitee user account
|
||||
* is still disabled and there are no outstanding pending invites for that invitee.
|
||||
*
|
||||
* @param inviteeUserName String
|
||||
* @param currentInviteId String
|
||||
*/
|
||||
public void deleteAuthenticationIfUnused(final String inviteeUserName, final String currentInviteId)
|
||||
{
|
||||
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
{
|
||||
// see if there are any pending invites (invite workflow instances with invitePending task in-progress)
|
||||
// outstanding for given invitee user name
|
||||
List<Invitation> pendingInvites = invitationService.listPendingInvitationsForInvitee(inviteeUserName);
|
||||
boolean invitesPending = CollectionUtils.isEmpty(pendingInvites)==false;
|
||||
if (invitesPending && pendingInvites.size() == 1)
|
||||
{
|
||||
Invitation pendingInvite = pendingInvites.get(0);
|
||||
if (pendingInvite.getInviteId().equals(currentInviteId))
|
||||
{
|
||||
invitesPending = false;
|
||||
}
|
||||
}
|
||||
|
||||
NodeRef person = personService.getPersonOrNull(inviteeUserName);
|
||||
|
||||
// if invitee's user account is still disabled and there are no pending invites outstanding
|
||||
// for the invitee, then remove the account and delete the invitee's person node
|
||||
if (person != null
|
||||
&& (authenticationService.isAuthenticationMutable(inviteeUserName))
|
||||
&& (authenticationService.getAuthenticationEnabled(inviteeUserName) == false)
|
||||
&& (invitesPending == false)
|
||||
&& nodeService.hasAspect(person, ContentModel.ASPECT_ANULLABLE))
|
||||
{
|
||||
// delete the invitee's user account
|
||||
authenticationService.deleteAuthentication(inviteeUserName);
|
||||
|
||||
// delete the invitee's person node if one exists
|
||||
if (personService.personExists(inviteeUserName))
|
||||
{
|
||||
personService.deletePerson(inviteeUserName);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param executionVariables Map<String, Object>
|
||||
* @param currentInviteId String
|
||||
*/
|
||||
public void cancelInvitation(Map<String, Object> executionVariables, String currentInviteId)
|
||||
{
|
||||
// Get the invitee user name and site short name variables off the execution context
|
||||
String inviteeUserName = (String) executionVariables.get(wfVarInviteeUserName);
|
||||
String siteShortName = (String) executionVariables.get(wfVarResourceName);
|
||||
|
||||
if (!AuthenticationUtil.isRunAsUserTheSystemUser())
|
||||
{
|
||||
String currentUserName = authenticationService.getCurrentUserName();
|
||||
String currentUserSiteRole = siteService.getMembersRole(siteShortName, currentUserName);
|
||||
if (SiteModel.SITE_MANAGER.equals(currentUserSiteRole)== false)
|
||||
{
|
||||
// The current user is not the site manager
|
||||
String inviteId = (String) executionVariables.get(wfVarWorkflowInstanceId);
|
||||
Object[] args = {currentUserName, inviteId, siteShortName};
|
||||
throw new InvitationExceptionForbidden(MSG_NOT_SITE_MANAGER, args);
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up invitee's user account and person node if they are not in use i.e.
|
||||
// account is still disabled and there are no pending invites outstanding for the
|
||||
// invitee
|
||||
deleteAuthenticationIfUnused(inviteeUserName, currentInviteId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implemented for backwards compatibility
|
||||
*
|
||||
* @param inviteId
|
||||
* @param executionVariables
|
||||
* @deprecated
|
||||
* @see {@link #sendNominatedInvitation(String, String, String, Map)}
|
||||
*/
|
||||
public void sendNominatedInvitation(String inviteId, Map<String, Object> executionVariables)
|
||||
{
|
||||
sendNominatedInvitation(
|
||||
inviteId, SendNominatedInviteDelegate.EMAIL_TEMPLATE_XPATH, SendNominatedInviteDelegate.EMAIL_SUBJECT_KEY, executionVariables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the invite email using the given template, subject localization key, and variables.
|
||||
*
|
||||
* @param inviteId
|
||||
* @param emailTemplateXpath the XPath to the email template in the repository
|
||||
* @param emailSubjectKey the subject of the email
|
||||
* @param executionVariables the variables used to populate the email
|
||||
*/
|
||||
public void sendNominatedInvitation(String inviteId, String emailTemplateXpath,
|
||||
String emailSubjectKey, Map<String, Object> executionVariables)
|
||||
{
|
||||
if (invitationService.isSendEmails())
|
||||
{
|
||||
Map<String, String> properties = makePropertiesFromContextVariables(executionVariables, sendInvitePropertyNames);
|
||||
|
||||
String packageName = WorkflowModel.ASSOC_PACKAGE.toPrefixString(namespaceService).replace(":", "_");
|
||||
ScriptNode packageNode = (ScriptNode) executionVariables.get(packageName);
|
||||
String packageRef = packageNode.getNodeRef().toString();
|
||||
properties.put(InviteSender.WF_PACKAGE, packageRef);
|
||||
|
||||
properties.put(InviteSender.WF_INSTANCE_ID, inviteId);
|
||||
|
||||
inviteSender.sendMail(emailTemplateXpath, emailSubjectKey, properties);
|
||||
}
|
||||
}
|
||||
|
||||
public void approveModeratedInvitation(Map<String, Object> executionVariables)
|
||||
{
|
||||
String siteName = (String)executionVariables.get(WorkflowModelModeratedInvitation.wfVarResourceName);
|
||||
String invitee= (String)executionVariables.get(WorkflowModelModeratedInvitation.wfVarInviteeUserName);
|
||||
String role = (String)executionVariables.get(WorkflowModelModeratedInvitation.wfVarInviteeRole);
|
||||
String reviewer = (String)executionVariables.get(WorkflowModelModeratedInvitation.wfVarReviewer);
|
||||
|
||||
// Add invitee to the site
|
||||
addSiteMembership(invitee, siteName, role, reviewer, false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<String, String> makePropertiesFromContextVariables(Map<?, ?> executionVariables, Collection<String> propertyNames)
|
||||
{
|
||||
return CollectionUtils.filterKeys((Map<String, String>) executionVariables, CollectionUtils.containsFilter(propertyNames));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vars Map<String, Object>
|
||||
*/
|
||||
public void rejectModeratedInvitation(Map<String, Object> vars)
|
||||
{
|
||||
//Do nothing if emails disabled.
|
||||
if (invitationService.isSendEmails() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
String resourceType = (String)vars.get(WorkflowModelModeratedInvitation.wfVarResourceType);
|
||||
String resourceName = (String)vars.get(WorkflowModelModeratedInvitation.wfVarResourceName);
|
||||
String inviteeUserName = (String)vars.get(WorkflowModelModeratedInvitation.wfVarInviteeUserName);
|
||||
String inviteeRole = (String)vars.get(WorkflowModelModeratedInvitation.wfVarInviteeRole);
|
||||
String reviewer = (String)vars.get(WorkflowModelModeratedInvitation.wfVarReviewer);
|
||||
String reviewComments = (String)vars.get(WorkflowModelModeratedInvitation.wfVarReviewComments);
|
||||
|
||||
// send email to the invitee if possible - but don't fail the rejection if email cannot be sent
|
||||
try
|
||||
{
|
||||
// Build our model
|
||||
Map<String, Serializable> model = new HashMap<String, Serializable>(8, 1.0f);
|
||||
model.put("resourceName", resourceName);
|
||||
model.put("resourceType", resourceType);
|
||||
model.put("inviteeRole", inviteeRole);
|
||||
model.put("reviewComments", reviewComments);
|
||||
model.put("reviewer", reviewer);
|
||||
model.put("inviteeUserName", inviteeUserName);
|
||||
|
||||
// Process the template
|
||||
// Note - because we use a classpath template, rather than a Data Dictionary
|
||||
// one, we can't have the MailActionExecutor do the template for us
|
||||
String emailMsg = templateService.processTemplate("freemarker", REJECT_TEMPLATE, model);
|
||||
|
||||
// Send
|
||||
Action emailAction = actionService.createAction("mail");
|
||||
emailAction.setParameterValue(MailActionExecuter.PARAM_TO, nodeService.getProperty(personService.getPerson(inviteeUserName), ContentModel.PROP_EMAIL));
|
||||
emailAction.setParameterValue(MailActionExecuter.PARAM_FROM, nodeService.getProperty(personService.getPerson(reviewer), ContentModel.PROP_EMAIL));
|
||||
//TODO Localize this.
|
||||
emailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, "Rejected invitation to web site:" + resourceName);
|
||||
emailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, emailMsg);
|
||||
emailAction.setExecuteAsynchronously(true);
|
||||
actionService.executeAction(emailAction, null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Swallow exception
|
||||
logger.error("unable to send reject email", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param messageService the messageService to set
|
||||
*/
|
||||
public void setMessageService(MessageService messageService)
|
||||
{
|
||||
this.messageService = messageService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param repositoryHelper the repositoryHelper to set
|
||||
*/
|
||||
public void setRepositoryHelper(Repository repositoryHelper)
|
||||
{
|
||||
this.repositoryHelper = repositoryHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param serviceRegistry the serviceRegistry to set
|
||||
*/
|
||||
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -35,6 +35,11 @@ public class ModeratedActionApprove extends AbstractInvitationAction
|
||||
public void execute(ExecutionContext executionContext) throws Exception
|
||||
{
|
||||
Map<String, Object> variables = executionContext.getContextInstance().getVariables();
|
||||
inviteHelper.approveModeratedInvitation(variables);
|
||||
String siteName = (String) variables.get(WorkflowModelModeratedInvitation.wfVarResourceName);
|
||||
String invitee = (String) variables.get(WorkflowModelModeratedInvitation.wfVarInviteeUserName);
|
||||
String role = (String) variables.get(WorkflowModelModeratedInvitation.wfVarInviteeRole);
|
||||
String reviewer = (String) variables.get(WorkflowModelModeratedInvitation.wfVarReviewer);
|
||||
|
||||
invitationService.approveModeratedInvitation(siteName, invitee, role, reviewer);
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -44,6 +44,13 @@ public class ModeratedActionReject extends AbstractInvitationAction
|
||||
public void execute(final ExecutionContext executionContext) throws Exception
|
||||
{
|
||||
Map<String, Object> vars = executionContext.getContextInstance().getVariables();
|
||||
inviteHelper.rejectModeratedInvitation(vars);
|
||||
String siteName = (String) vars.get(WorkflowModelModeratedInvitation.wfVarResourceName);
|
||||
String invitee = (String) vars.get(WorkflowModelModeratedInvitation.wfVarInviteeUserName);
|
||||
String role = (String) vars.get(WorkflowModelModeratedInvitation.wfVarInviteeRole);
|
||||
String reviewer = (String) vars.get(WorkflowModelModeratedInvitation.wfVarReviewer);
|
||||
String resourceType = (String) vars.get(WorkflowModelModeratedInvitation.wfVarResourceType);
|
||||
String reviewComments = (String) vars.get(WorkflowModelModeratedInvitation.wfVarReviewComments);
|
||||
|
||||
invitationService.rejectModeratedInvitation(siteName, invitee, role, reviewer, resourceType, reviewComments);
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
package org.alfresco.repo.invitation.activiti;
|
||||
|
||||
import org.alfresco.repo.invitation.InviteHelper;
|
||||
import org.alfresco.repo.workflow.activiti.BaseJavaDelegate;
|
||||
import org.alfresco.service.cmr.invitation.InvitationService;
|
||||
|
||||
/**
|
||||
* @author Nick Smith
|
||||
@@ -29,13 +29,13 @@ import org.alfresco.repo.workflow.activiti.BaseJavaDelegate;
|
||||
*/
|
||||
public abstract class AbstractInvitationDelegate extends BaseJavaDelegate
|
||||
{
|
||||
protected InviteHelper inviteHelper;
|
||||
protected InvitationService invitationService;
|
||||
|
||||
/**
|
||||
* @param inviteHelper the inviteHelper to set
|
||||
* @param invitationService the invitationService to set
|
||||
*/
|
||||
public void setInviteHelper(InviteHelper inviteHelper)
|
||||
public void setInvitationService(InvitationService invitationService)
|
||||
{
|
||||
this.inviteHelper = inviteHelper;
|
||||
this.invitationService = invitationService;
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -21,10 +21,10 @@ package org.alfresco.repo.invitation.activiti;
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.engine.delegate.DelegateExecution;
|
||||
import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
|
||||
|
||||
/**
|
||||
* Activiti delegate that is executed when a nominated invitation request has
|
||||
* been accepted.
|
||||
* Activiti delegate that is executed when a nominated invitation request has been accepted.
|
||||
*
|
||||
* @author Nick Smith
|
||||
* @author Frederik Heremans
|
||||
@@ -37,6 +37,11 @@ public class AcceptNominatedInviteDelegate extends AbstractInvitationDelegate
|
||||
public void execute(DelegateExecution execution) throws Exception
|
||||
{
|
||||
Map<String, Object> executionVariables = execution.getVariables();
|
||||
inviteHelper.acceptNominatedInvitation(executionVariables);
|
||||
String invitee = (String) executionVariables.get(WorkflowModelNominatedInvitation.wfVarInviteeUserName);
|
||||
String siteName = (String) executionVariables.get(WorkflowModelNominatedInvitation.wfVarResourceName);
|
||||
String inviter = (String) executionVariables.get(WorkflowModelNominatedInvitation.wfVarInviterUserName);
|
||||
String role = (String) executionVariables.get(WorkflowModelNominatedInvitation.wfVarRole);
|
||||
|
||||
invitationService.acceptNominatedInvitation(siteName, invitee, role, inviter);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -18,11 +18,13 @@
|
||||
*/
|
||||
package org.alfresco.repo.invitation.activiti;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.engine.delegate.DelegateExecution;
|
||||
import org.alfresco.repo.invitation.WorkflowModelModeratedInvitation;
|
||||
|
||||
/**
|
||||
* Activiti delegate that is executed when a invitation-moderated process is reviewed
|
||||
* and approved.
|
||||
* Activiti delegate that is executed when a invitation-moderated process is reviewed and approved.
|
||||
*
|
||||
* @author Nick Smith
|
||||
* @author Frederik Heremans
|
||||
@@ -33,6 +35,12 @@ public class ApproveModeratedInviteDelegate extends AbstractInvitationDelegate
|
||||
@Override
|
||||
public void execute(DelegateExecution execution) throws Exception
|
||||
{
|
||||
inviteHelper.approveModeratedInvitation(execution.getVariables());
|
||||
Map<String, Object> variables = execution.getVariables();
|
||||
String siteName = (String) variables.get(WorkflowModelModeratedInvitation.wfVarResourceName);
|
||||
String invitee = (String) variables.get(WorkflowModelModeratedInvitation.wfVarInviteeUserName);
|
||||
String role = (String) variables.get(WorkflowModelModeratedInvitation.wfVarInviteeRole);
|
||||
String reviewer = (String) variables.get(WorkflowModelModeratedInvitation.wfVarReviewer);
|
||||
|
||||
invitationService.approveModeratedInvitation(siteName, invitee, role, reviewer);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -18,14 +18,17 @@
|
||||
*/
|
||||
package org.alfresco.repo.invitation.activiti;
|
||||
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarInviteeUserName;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarResourceName;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarWorkflowInstanceId;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.engine.delegate.DelegateExecution;
|
||||
import org.alfresco.repo.workflow.activiti.ActivitiConstants;
|
||||
|
||||
/**
|
||||
* Activiti delegate that is executed when a invitation request has
|
||||
* been cancelled.
|
||||
* Activiti delegate that is executed when a invitation request has been cancelled.
|
||||
*
|
||||
* @author Nick Smith
|
||||
* @author Frederik Heremans
|
||||
@@ -37,7 +40,13 @@ public class CancelNominatedInviteDelegate extends AbstractInvitationDelegate
|
||||
public void execute(DelegateExecution execution) throws Exception
|
||||
{
|
||||
Map<String, Object> executionVariables = execution.getVariables();
|
||||
String invitationId = ActivitiConstants.ENGINE_ID + "$" + execution.getProcessInstanceId();
|
||||
inviteHelper.cancelInvitation(executionVariables, invitationId);
|
||||
String currentInviteId = ActivitiConstants.ENGINE_ID + "$" + execution.getProcessInstanceId();
|
||||
|
||||
// Get the invitee user name and site short name variables off the execution context
|
||||
String invitee = (String) executionVariables.get(wfVarInviteeUserName);
|
||||
String siteName = (String) executionVariables.get(wfVarResourceName);
|
||||
String inviteId = (String) executionVariables.get(wfVarWorkflowInstanceId);
|
||||
|
||||
invitationService.cancelInvitation(siteName, invitee, inviteId, currentInviteId);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -18,8 +18,11 @@
|
||||
*/
|
||||
package org.alfresco.repo.invitation.activiti;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.engine.delegate.DelegateExecution;
|
||||
import org.alfresco.repo.invitation.ModeratedActionReject;
|
||||
import org.alfresco.repo.invitation.WorkflowModelModeratedInvitation;
|
||||
|
||||
/**
|
||||
* Activiti delegate that is executed when a invitation-moderated process is reviewed
|
||||
@@ -36,6 +39,14 @@ public class RejectModeratedInviteDelegate extends AbstractInvitationDelegate
|
||||
@Override
|
||||
public void execute(DelegateExecution execution) throws Exception
|
||||
{
|
||||
inviteHelper.rejectModeratedInvitation(execution.getVariables());
|
||||
Map<String, Object> vars = execution.getVariables();
|
||||
String siteName = (String) vars.get(WorkflowModelModeratedInvitation.wfVarResourceName);
|
||||
String invitee = (String) vars.get(WorkflowModelModeratedInvitation.wfVarInviteeUserName);
|
||||
String role = (String) vars.get(WorkflowModelModeratedInvitation.wfVarInviteeRole);
|
||||
String reviewer = (String) vars.get(WorkflowModelModeratedInvitation.wfVarReviewer);
|
||||
String resourceType = (String) vars.get(WorkflowModelModeratedInvitation.wfVarResourceType);
|
||||
String reviewComments = (String) vars.get(WorkflowModelModeratedInvitation.wfVarReviewComments);
|
||||
|
||||
invitationService.rejectModeratedInvitation(siteName, invitee, role, reviewer, resourceType, reviewComments);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -23,8 +23,7 @@ import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
|
||||
import org.alfresco.repo.workflow.activiti.ActivitiConstants;
|
||||
|
||||
/**
|
||||
* Activiti delegate that is executed when a invitation request has
|
||||
* been rejected.
|
||||
* Activiti delegate that is executed when a invitation request has been rejected.
|
||||
*
|
||||
* @author Nick Smith
|
||||
* @author Frederik Heremans
|
||||
@@ -36,8 +35,8 @@ public class RejectNominatedInviteDelegate extends AbstractInvitationDelegate
|
||||
public void execute(DelegateExecution execution) throws Exception
|
||||
{
|
||||
// Get the invitee user name
|
||||
String inviteeUserName = (String) execution.getVariable(WorkflowModelNominatedInvitation.wfVarInviteeUserName);
|
||||
String invitee = (String) execution.getVariable(WorkflowModelNominatedInvitation.wfVarInviteeUserName);
|
||||
String invitationId = ActivitiConstants.ENGINE_ID + "$" + execution.getProcessInstanceId();
|
||||
inviteHelper.deleteAuthenticationIfUnused(inviteeUserName, invitationId);
|
||||
invitationService.deleteAuthenticationIfUnused(invitee, invitationId);
|
||||
}
|
||||
}
|
||||
|
@@ -44,6 +44,6 @@ public class SendNominatedInviteAddDirectDelegate extends AbstractInvitationDele
|
||||
{
|
||||
String invitationId = ActivitiConstants.ENGINE_ID + "$" + execution.getProcessInstanceId();
|
||||
Map<String, Object> variables = execution.getVariables();
|
||||
inviteHelper.sendNominatedInvitation(invitationId, EMAIL_TEMPLATE_XPATH, EMAIL_SUBJECT_KEY, variables);
|
||||
invitationService.sendNominatedInvitation(invitationId, EMAIL_TEMPLATE_XPATH, EMAIL_SUBJECT_KEY, variables);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -24,8 +24,7 @@ import org.activiti.engine.delegate.DelegateExecution;
|
||||
import org.alfresco.repo.workflow.activiti.ActivitiConstants;
|
||||
|
||||
/**
|
||||
* Activiti delegate that is executed when a invitation request has
|
||||
* been sent.
|
||||
* Activiti delegate that is executed when a invitation request has been sent.
|
||||
*
|
||||
* @author Nick Smith
|
||||
* @author Frederik Heremans
|
||||
@@ -43,6 +42,6 @@ public class SendNominatedInviteDelegate extends AbstractInvitationDelegate
|
||||
{
|
||||
String invitationId = ActivitiConstants.ENGINE_ID + "$" + execution.getProcessInstanceId();
|
||||
Map<String, Object> variables = execution.getVariables();
|
||||
inviteHelper.sendNominatedInvitation(invitationId, EMAIL_TEMPLATE_XPATH, EMAIL_SUBJECT_KEY, variables);
|
||||
invitationService.sendNominatedInvitation(invitationId, EMAIL_TEMPLATE_XPATH, EMAIL_SUBJECT_KEY, variables);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
package org.alfresco.repo.invitation.site;
|
||||
|
||||
import org.alfresco.repo.invitation.InviteHelper;
|
||||
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
|
||||
import org.alfresco.service.cmr.invitation.InvitationService;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
public abstract class AbstractInvitationAction extends JBPMSpringActionHandler
|
||||
{
|
||||
private static final long serialVersionUID = -6497378327090711383L;
|
||||
protected InviteHelper inviteHelper;
|
||||
protected InvitationService invitationService;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
@@ -39,6 +39,6 @@ public abstract class AbstractInvitationAction extends JBPMSpringActionHandler
|
||||
@Override
|
||||
protected void initialiseHandler(BeanFactory factory)
|
||||
{
|
||||
this.inviteHelper= (InviteHelper)factory.getBean(InviteHelper.NAME);
|
||||
this.invitationService = (InvitationService)factory.getBean("InvitationService");
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -20,6 +20,7 @@ package org.alfresco.repo.invitation.site;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
|
||||
import org.jbpm.graph.exe.ExecutionContext;
|
||||
|
||||
/**
|
||||
@@ -41,6 +42,11 @@ public class AcceptInviteAction extends AbstractInvitationAction
|
||||
public void execute(final ExecutionContext executionContext) throws Exception
|
||||
{
|
||||
Map<String, Object> executionVariables = executionContext.getContextInstance().getVariables();
|
||||
inviteHelper.acceptNominatedInvitation(executionVariables);
|
||||
String invitee = (String) executionVariables.get(WorkflowModelNominatedInvitation.wfVarInviteeUserName);
|
||||
String siteName = (String) executionVariables.get(WorkflowModelNominatedInvitation.wfVarResourceName);
|
||||
String inviter = (String) executionVariables.get(WorkflowModelNominatedInvitation.wfVarInviterUserName);
|
||||
String role = (String) executionVariables.get(WorkflowModelNominatedInvitation.wfVarRole);
|
||||
|
||||
invitationService.acceptNominatedInvitation(siteName, invitee, role, inviter);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -18,6 +18,10 @@
|
||||
*/
|
||||
package org.alfresco.repo.invitation.site;
|
||||
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarInviteeUserName;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarResourceName;
|
||||
import static org.alfresco.repo.invitation.WorkflowModelNominatedInvitation.wfVarWorkflowInstanceId;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.workflow.jbpm.JBPMEngine;
|
||||
@@ -41,7 +45,13 @@ public class CancelInviteAction extends AbstractInvitationAction
|
||||
public void execute(ExecutionContext executionContext) throws Exception
|
||||
{
|
||||
Map<String, Object> executionVariables = executionContext.getContextInstance().getVariables();
|
||||
String invitationId = JBPMEngine.ENGINE_ID + "$" + executionContext.getContextInstance().getProcessInstance().getId();
|
||||
inviteHelper.cancelInvitation(executionVariables, invitationId);
|
||||
String currentInviteId = JBPMEngine.ENGINE_ID + "$" + executionContext.getContextInstance().getProcessInstance().getId();
|
||||
|
||||
// Get the invitee user name and site short name variables off the execution context
|
||||
String invitee = (String) executionVariables.get(wfVarInviteeUserName);
|
||||
String siteName = (String) executionVariables.get(wfVarResourceName);
|
||||
String inviteId = (String) executionVariables.get(wfVarWorkflowInstanceId);
|
||||
|
||||
invitationService.cancelInvitation(siteName, invitee, inviteId, currentInviteId);
|
||||
}
|
||||
}
|
||||
|
@@ -39,8 +39,9 @@ public class RejectInviteAction extends AbstractInvitationAction
|
||||
public void execute(final ExecutionContext executionContext) throws Exception
|
||||
{
|
||||
// get the invitee user name
|
||||
String inviteeUserName = (String) executionContext.getVariable(WorkflowModelNominatedInvitation.wfVarInviteeUserName);
|
||||
String invitee = (String) executionContext.getVariable(WorkflowModelNominatedInvitation.wfVarInviteeUserName);
|
||||
String invitationId = JBPMEngine.ENGINE_ID + "$" + executionContext.getContextInstance().getProcessInstance().getId();
|
||||
inviteHelper.deleteAuthenticationIfUnused(inviteeUserName, invitationId);
|
||||
|
||||
invitationService.deleteAuthenticationIfUnused(invitee, invitationId);
|
||||
}
|
||||
}
|
||||
|
@@ -41,6 +41,6 @@ public class SendInviteAction extends AbstractInvitationAction
|
||||
long processId = contextInstance.getProcessInstance().getId();
|
||||
String inviteId = JBPMEngine.ENGINE_ID + "$" + processId;
|
||||
Map<String, Object> executionVariables = contextInstance.getVariables();
|
||||
inviteHelper.sendNominatedInvitation(inviteId, EMAIL_TEMPLATE_XPATH, EMAIL_SUBJECT_KEY, executionVariables);
|
||||
invitationService.sendNominatedInvitation(inviteId, EMAIL_TEMPLATE_XPATH, EMAIL_SUBJECT_KEY, executionVariables);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -19,17 +19,14 @@
|
||||
package org.alfresco.service.cmr.invitation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.service.Auditable;
|
||||
import org.alfresco.service.NotAuditable;
|
||||
|
||||
/**
|
||||
* The invitation service provides the ability to invite
|
||||
* people to resources. For example adding a user to a shared web site.
|
||||
*
|
||||
* It manages the relationship between person, resource and requestType
|
||||
* and may also pass along information such as who is to approve or the expected
|
||||
* role of the user.
|
||||
* The invitation service provides the ability to invite people to resources. For example adding a user to a shared web site. It manages the relationship between person, resource
|
||||
* and requestType and may also pass along information such as who is to approve or the expected role of the user.
|
||||
*
|
||||
* @author mrogers
|
||||
*/
|
||||
@@ -44,180 +41,102 @@ public interface InvitationService
|
||||
public List<String> getInvitationServiceWorkflowNames();
|
||||
|
||||
/**
|
||||
* Start the invitation process for a NominatedInvitation for a user who does not yet have an Alfresco User Name
|
||||
* The server path is calculated based on the sysAdmin parameters
|
||||
* Start the invitation process for a NominatedInvitation for a user who does not yet have an Alfresco User Name The server path is calculated based on the sysAdmin parameters
|
||||
*
|
||||
* @param inviteeUserName Alfresco user name of who should be invited
|
||||
* @param resourceType resourceType
|
||||
* @param resourceName String
|
||||
* @param inviteeRole String
|
||||
* @param acceptUrl String
|
||||
* @param rejectUrl String
|
||||
*
|
||||
* @return the nominated invitation which will contain the invitationId and
|
||||
* ticket which will uniqely identify this invitation for the rest
|
||||
* of the workflow.
|
||||
*
|
||||
* @param ResourceType resourceType
|
||||
* @param resourceName
|
||||
* @param inviteeRole
|
||||
* @param acceptUrl
|
||||
* @param rejectUrl
|
||||
* @return the nominated invitation which will contain the invitationId and ticket which will uniqely identify this invitation for the rest of the workflow.
|
||||
* @throws InvitationException
|
||||
* @throws InvitationExceptionUserError
|
||||
* @throws InvitationExceptionForbidden
|
||||
*/
|
||||
@Auditable(parameters = {"inviteeUserName",
|
||||
"resourceType",
|
||||
"resourceName",
|
||||
"inviteeRole",
|
||||
"acceptUrl",
|
||||
"rejectUrl"})
|
||||
|
||||
public NominatedInvitation inviteNominated(
|
||||
String inviteeUserName,
|
||||
Invitation.ResourceType resourceType,
|
||||
String resourceName,
|
||||
String inviteeRole,
|
||||
String acceptUrl,
|
||||
@Auditable(parameters = { "inviteeUserName", "resourceType", "resourceName", "inviteeRole", "acceptUrl", "rejectUrl" })
|
||||
public NominatedInvitation inviteNominated(String inviteeUserName, Invitation.ResourceType resourceType, String resourceName, String inviteeRole, String acceptUrl,
|
||||
String rejectUrl);
|
||||
|
||||
/**
|
||||
* Start the invitation process for a NominatedInvitation for a user who does not yet have an
|
||||
* Alfresco User NameA new user name will be generated as part of the invitation process.
|
||||
* The server path is calculated based on the sysAdmin parameters
|
||||
*
|
||||
* @param inviteeFirstName String
|
||||
* @param inviteeLastName String
|
||||
* @param inviteeEmail String
|
||||
* @param resourceType Invitation.ResourceType
|
||||
* @param resourceName String
|
||||
* @param inviteeRole String
|
||||
* @param acceptUrl String
|
||||
* @param rejectUrl String
|
||||
*
|
||||
* @return the nominated invitation which will contain the invitationId and ticket which
|
||||
* will uniquely identify this invitation.
|
||||
* Start the invitation process for a NominatedInvitation for a user who does not yet have an Alfresco User NameA new user name will be generated as part of the invitation
|
||||
* process. The server path is calculated based on the sysAdmin parameters
|
||||
*
|
||||
* @param inviteeFirstName
|
||||
* @param inviteeLastName
|
||||
* @param inviteeEmail
|
||||
* @param Invitation.ResourceType resourceType
|
||||
* @param resourceName
|
||||
* @param inviteeRole
|
||||
* @param acceptUrl
|
||||
* @param rejectUrl
|
||||
* @return the nominated invitation which will contain the invitationId and ticket which will uniquely identify this invitation.
|
||||
* @throws InvitationException
|
||||
* @throws InvitationExceptionUserError
|
||||
* @throws InvitationExceptionForbidden
|
||||
*/
|
||||
@Auditable(parameters = {
|
||||
"inviteeFirstName",
|
||||
"inviteeLastName",
|
||||
"inviteeEmail",
|
||||
"resourceType",
|
||||
"resourceName",
|
||||
"inviteeRole",
|
||||
"acceptUrl",
|
||||
"rejectUrl"})
|
||||
public NominatedInvitation inviteNominated(
|
||||
String inviteeFirstName,
|
||||
String inviteeLastName,
|
||||
String inviteeEmail,
|
||||
Invitation.ResourceType resourceType,
|
||||
String resourceName,
|
||||
String inviteeRole,
|
||||
String acceptUrl,
|
||||
String rejectUrl);
|
||||
@Auditable(parameters = { "inviteeFirstName", "inviteeLastName", "inviteeEmail", "resourceType", "resourceName", "inviteeRole", "acceptUrl", "rejectUrl" })
|
||||
public NominatedInvitation inviteNominated(String inviteeFirstName, String inviteeLastName, String inviteeEmail, Invitation.ResourceType resourceType, String resourceName,
|
||||
String inviteeRole, String acceptUrl, String rejectUrl);
|
||||
|
||||
/**
|
||||
* Start the invitation process for a NominatedInvitation for a user who does not yet have an Alfresco User Name
|
||||
*
|
||||
* @param inviteeUserName Alfresco user name of who should be invited
|
||||
* @param resourceType resourceType
|
||||
* @param resourceName String
|
||||
* @param inviteeRole String
|
||||
* @param serverPath String
|
||||
* @param acceptUrl String
|
||||
* @param rejectUrl String
|
||||
*
|
||||
* @return the nominated invitation which will contain the invitationId and
|
||||
* ticket which will uniqely identify this invitation for the rest
|
||||
* of the workflow.
|
||||
*
|
||||
* @param ResourceType resourceType
|
||||
* @param resourceName
|
||||
* @param inviteeRole
|
||||
* @param serverPath
|
||||
* @param acceptUrl
|
||||
* @param rejectUrl
|
||||
* @return the nominated invitation which will contain the invitationId and ticket which will uniqely identify this invitation for the rest of the workflow.
|
||||
* @throws InvitationException
|
||||
* @throws InvitationExceptionUserError
|
||||
* @throws InvitationExceptionForbidden
|
||||
*/
|
||||
@Auditable(parameters = {"inviteeUserName",
|
||||
"resourceType",
|
||||
"resourceName",
|
||||
"inviteeRole",
|
||||
"serverPath",
|
||||
"acceptUrl",
|
||||
"rejectUrl"})
|
||||
|
||||
public NominatedInvitation inviteNominated(
|
||||
String inviteeUserName,
|
||||
Invitation.ResourceType resourceType,
|
||||
String resourceName,
|
||||
String inviteeRole,
|
||||
String serverPath,
|
||||
String acceptUrl,
|
||||
String rejectUrl) ;
|
||||
@Auditable(parameters = { "inviteeUserName", "resourceType", "resourceName", "inviteeRole", "serverPath", "acceptUrl", "rejectUrl" })
|
||||
public NominatedInvitation inviteNominated(String inviteeUserName, Invitation.ResourceType resourceType, String resourceName, String inviteeRole, String serverPath,
|
||||
String acceptUrl, String rejectUrl);
|
||||
|
||||
/**
|
||||
* Start the invitation process for a NominatedInvitation for a user who does not yet have an
|
||||
* Alfresco User NameA new user name will be generated as part of the invitation process.
|
||||
* Start the invitation process for a NominatedInvitation for a user who does not yet have an Alfresco User NameA new user name will be generated as part of the invitation
|
||||
* process.
|
||||
*
|
||||
* @param inviteeFirstName String
|
||||
* @param inviteeLastName String
|
||||
* @param inviteeFirstName
|
||||
* @param inviteeLastName
|
||||
* @param inviteeEmail String
|
||||
* @param resourceType Invitation.ResourceType
|
||||
* @param resourceName String
|
||||
* @param inviteeRole String
|
||||
* @param serverPath String
|
||||
* @param acceptUrl String
|
||||
* @param inviteeRole
|
||||
* @param serverPath
|
||||
* @param acceptUrl
|
||||
* @param rejectUrl String
|
||||
*
|
||||
* @return the nominated invitation which will contain the invitationId and ticket which
|
||||
* will uniquely identify this invitation.
|
||||
*
|
||||
* @return the nominated invitation which will contain the invitationId and ticket which will uniquely identify this invitation.
|
||||
* @throws InvitationException
|
||||
* @throws InvitationExceptionUserError
|
||||
* @throws InvitationExceptionForbidden
|
||||
*/
|
||||
@Auditable(parameters = {
|
||||
"inviteeFirstName",
|
||||
"inviteeLastName",
|
||||
"inviteeEmail",
|
||||
"resourceType",
|
||||
"resourceName",
|
||||
"inviteeRole",
|
||||
"serverPath",
|
||||
"acceptUrl",
|
||||
"rejectUrl"})
|
||||
public NominatedInvitation inviteNominated(
|
||||
String inviteeFirstName,
|
||||
String inviteeLastName,
|
||||
String inviteeEmail,
|
||||
Invitation.ResourceType resourceType,
|
||||
String resourceName,
|
||||
String inviteeRole,
|
||||
String serverPath,
|
||||
String acceptUrl,
|
||||
String rejectUrl);
|
||||
@Auditable(parameters = { "inviteeFirstName", "inviteeLastName", "inviteeEmail", "resourceType", "resourceName", "inviteeRole", "serverPath", "acceptUrl", "rejectUrl" })
|
||||
public NominatedInvitation inviteNominated(String inviteeFirstName, String inviteeLastName, String inviteeEmail, Invitation.ResourceType resourceType, String resourceName,
|
||||
String inviteeRole, String serverPath, String acceptUrl, String rejectUrl);
|
||||
|
||||
/**
|
||||
* Start the invitation process for a ModeratedInvitation
|
||||
*
|
||||
* @param inviteeUserName who is to be invited
|
||||
* @param resourceType Invitation.ResourceType what resource type ?
|
||||
* @param Invitation.ResourceType resourceType what resource type ?
|
||||
* @param resourceName which resource
|
||||
* @param inviteeRole which role ?
|
||||
*/
|
||||
@Auditable(parameters = {
|
||||
"inviteeComments",
|
||||
"inviteeUserName",
|
||||
"resourceType",
|
||||
"resourceName",
|
||||
"inviteeRole"})
|
||||
public ModeratedInvitation inviteModerated(
|
||||
String inviteeComments,
|
||||
String inviteeUserName,
|
||||
Invitation.ResourceType resourceType,
|
||||
String resourceName,
|
||||
String inviteeRole);
|
||||
@Auditable(parameters = { "inviteeComments", "inviteeUserName", "resourceType", "resourceName", "inviteeRole" })
|
||||
public ModeratedInvitation inviteModerated(String inviteeComments, String inviteeUserName, Invitation.ResourceType resourceType, String resourceName, String inviteeRole);
|
||||
|
||||
/**
|
||||
* Update the invitee comments for an existing moderated invitation
|
||||
*
|
||||
* @param inviteeId String
|
||||
* @param siteShortName String
|
||||
* @param inviteeComments String
|
||||
* @param inviteeId
|
||||
* @param siteShortName
|
||||
* @param inviteeComments
|
||||
* @return the invitation
|
||||
*/
|
||||
@Auditable(parameters = { "inviteeId", "siteShortName", "inviteeComments" })
|
||||
@@ -226,14 +145,13 @@ public interface InvitationService
|
||||
/**
|
||||
* For a Nominated Invitation invitee accepts this invitation
|
||||
*
|
||||
* @param invitationId String
|
||||
* @param ticket String
|
||||
* @param request
|
||||
* @param ticket
|
||||
* @return the invitation
|
||||
*/
|
||||
@Auditable(parameters = { "invitationId", "reason" })
|
||||
public Invitation accept(String invitationId, String ticket);
|
||||
|
||||
|
||||
/**
|
||||
* Moderator approves this invitation
|
||||
*
|
||||
@@ -245,12 +163,58 @@ public interface InvitationService
|
||||
|
||||
/**
|
||||
* User or moderator rejects this request
|
||||
* @param invitationId String
|
||||
* @param reason String
|
||||
*
|
||||
* @param invitationId
|
||||
* @param reason
|
||||
*/
|
||||
@Auditable(parameters = { "invitationId", "reason" })
|
||||
public Invitation reject(String invitationId, String reason);
|
||||
|
||||
/**
|
||||
* Moderator approves this invitation
|
||||
*
|
||||
* @param siteName
|
||||
* @param invitee
|
||||
* @param role
|
||||
* @param inviter
|
||||
*/
|
||||
@Auditable(parameters = { "siteName", "Invitee", "role", "inviter" })
|
||||
public void acceptNominatedInvitation(String siteName, String invitee, String role, String inviter);
|
||||
|
||||
/**
|
||||
* Moderator approves this invitation
|
||||
*
|
||||
* @param siteName
|
||||
* @param invitee
|
||||
* @param role
|
||||
* @param reviewer
|
||||
*/
|
||||
@Auditable(parameters = { "siteName", "Invitee", "role", "reviewer" })
|
||||
public void approveModeratedInvitation(String siteName, String invitee, String role, String reviewer);
|
||||
|
||||
/**
|
||||
* Moderator rejects this invitation
|
||||
*
|
||||
* @param siteName
|
||||
* @param invitee
|
||||
* @param role
|
||||
* @param reviewer
|
||||
* @param resourceType
|
||||
* @param reviewComments
|
||||
*/
|
||||
@Auditable(parameters = { "siteName", "Invitee", "role", "reviewer", "resourceType", "reviewComments" })
|
||||
public void rejectModeratedInvitation(String siteName, String invitee, String role, String reviewer, String resourceType, String reviewComments);
|
||||
|
||||
/**
|
||||
* Inviter cancels this invitation
|
||||
*
|
||||
* @param siteName
|
||||
* @param invitee
|
||||
* @param inviteId
|
||||
* @param currentInviteId
|
||||
*/
|
||||
@Auditable(parameters = { "siteName", "Invitee", "inviteId", "currentInviteId" })
|
||||
public void cancelInvitation(String siteName, String invitee, String inviteId, String currentInviteId);
|
||||
|
||||
/**
|
||||
* cancel this request
|
||||
@@ -258,10 +222,44 @@ public interface InvitationService
|
||||
@Auditable(parameters = { "invitationId" })
|
||||
public Invitation cancel(String invitationId);
|
||||
|
||||
/**
|
||||
* Clean up invitee user account and person node when no longer in use.
|
||||
* They are deemed to no longer be in use when the invitee user account
|
||||
* is still disabled and there are no outstanding pending invites for that invitee.
|
||||
*
|
||||
* @param invitee
|
||||
* @param currentInviteId
|
||||
*/
|
||||
@Auditable(parameters = { "Invitee", "currentInviteId" })
|
||||
public void deleteAuthenticationIfUnused(String invitee, String currentInviteId);
|
||||
|
||||
/**
|
||||
* Implemented for backwards compatibility
|
||||
*
|
||||
* @param inviteId
|
||||
* @param executionVariables
|
||||
* @deprecated
|
||||
* @see {@link #sendNominatedInvitation(String, String, String, Map)}
|
||||
*/
|
||||
@Auditable(parameters = { "inviteId" })
|
||||
public void sendNominatedInvitation(String inviteId, Map<String, Object> executionVariables);
|
||||
|
||||
/**
|
||||
* Sends the invite email using the given template, subject localization key, and variables.
|
||||
*
|
||||
* @param inviteId
|
||||
* @param emailTemplateXpath the XPath to the email template in the repository
|
||||
* @param emailSubjectKey the subject of the email
|
||||
* @param executionVariables the variables used to populate the email
|
||||
*/
|
||||
@Auditable(parameters = { "inviteId" })
|
||||
public void sendNominatedInvitation(String inviteId, String emailTemplateXpath,
|
||||
String emailSubjectKey, Map<String, Object> executionVariables);
|
||||
|
||||
/**
|
||||
* get an invitation from its invitation id
|
||||
*
|
||||
* @param invitationId String
|
||||
* @param invitationId;
|
||||
*/
|
||||
@NotAuditable
|
||||
public Invitation getInvitation(String invitationId);
|
||||
@@ -277,8 +275,9 @@ public interface InvitationService
|
||||
|
||||
/**
|
||||
* list Invitations for a specific resource
|
||||
* @param resourceType Invitation.ResourceType
|
||||
* @param resourceName String
|
||||
*
|
||||
* @param resourceType
|
||||
* @param resourceName
|
||||
*/
|
||||
@NotAuditable
|
||||
public List<Invitation> listPendingInvitationsForResource(Invitation.ResourceType resourceType, String resourceName);
|
||||
|
Reference in New Issue
Block a user