mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged V3.2 to HEAD
18023: RM: groundwork for custom metadata delete 18071: MT - fix ETHREEOH-3730 (reject invitation shows "Invitation not found" instead of Yes / No options) 18078: MT - fix ETHREEOH-3892 (it is not possible to create or manage any Tenants once the DOD5015 RM AMP is installed) 18903: RM Caveats - fix ALF-1894 (improvement for ESC - remove hardcoded "rmc" model/namespace) 19046: Improve dictionary debug logging (ALF-587) 19096: Merging PATCHES/V3.2.r to V3.2 19075: Merging DEV/BELARUS/V3.2-2010_02_24 to PATCHES/V3.2.r 18881: ALF-587: MT Upgrades to 3.2r fail unable to find Alfresco content types 19085: ALF-587 - test/build fix (follow on for r18881->r19075) 19145: Dynamic Models - follow-on for ALF-587 (& ALFCOM-2977) + additional unit tests 19176: Remove Java 6'ism 19198: Build/test fix (follow-on to r19145 - do not validate model delete of version nodes) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19260 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,43 +18,18 @@
|
||||
*/
|
||||
package org.alfresco.repo.web.scripts.invite;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
|
||||
import org.alfresco.repo.invitation.site.InviteHelper;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||
import org.alfresco.repo.security.authentication.PasswordGenerator;
|
||||
import org.alfresco.repo.security.authentication.UserNameGenerator;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.site.SiteModel;
|
||||
import org.alfresco.repo.workflow.WorkflowModel;
|
||||
import org.alfresco.service.cmr.invitation.Invitation;
|
||||
import org.alfresco.service.cmr.invitation.InvitationException;
|
||||
import org.alfresco.service.cmr.invitation.InvitationExceptionForbidden;
|
||||
import org.alfresco.service.cmr.invitation.InvitationExceptionUserError;
|
||||
import org.alfresco.service.cmr.invitation.InvitationService;
|
||||
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.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.site.SiteService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowException;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowPath;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
@@ -73,11 +48,9 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class Invite extends DeclarativeWebScript
|
||||
{
|
||||
private static final Log logger = LogFactory.getLog(Invite.class);
|
||||
|
||||
private static final String ACTION_START = "start";
|
||||
private static final String ACTION_CANCEL = "cancel";
|
||||
|
||||
|
||||
private static final String MODEL_PROP_KEY_ACTION = "action";
|
||||
private static final String MODEL_PROP_KEY_INVITE_ID = "inviteId";
|
||||
private static final String MODEL_PROP_KEY_INVITE_TICKET = "inviteTicket";
|
||||
@@ -101,129 +74,18 @@ public class Invite extends DeclarativeWebScript
|
||||
|
||||
// services
|
||||
private WorkflowService workflowService;
|
||||
private PersonService personService;
|
||||
private AuthenticationService authenticationService;
|
||||
private PermissionService permissionService;
|
||||
private MutableAuthenticationDao mutableAuthenticationDao;
|
||||
private SiteService siteService;
|
||||
private NodeService nodeService;
|
||||
private NamespaceService namespaceService;
|
||||
|
||||
// user name and password generation beans
|
||||
private UserNameGenerator usernameGenerator;
|
||||
private PasswordGenerator passwordGenerator;
|
||||
private InvitationService invitationService;
|
||||
|
||||
/**
|
||||
* Sets the workflowService property
|
||||
*
|
||||
* @param workflowService
|
||||
* the workflow service to set
|
||||
*/
|
||||
|
||||
public void setWorkflowService(WorkflowService workflowService)
|
||||
{
|
||||
this.workflowService = workflowService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the personService property
|
||||
*
|
||||
* @param personService
|
||||
* the person service to set
|
||||
*/
|
||||
public void setPersonService(PersonService personService)
|
||||
|
||||
public void setInvitationService(InvitationService invitationService)
|
||||
{
|
||||
this.personService = personService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the authenticationService property
|
||||
*
|
||||
* @param authenticationService
|
||||
* the authentication service to set
|
||||
*/
|
||||
public void setAuthenticationService(
|
||||
AuthenticationService authenticationService)
|
||||
{
|
||||
this.authenticationService = authenticationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the mutable authentication DAO
|
||||
*
|
||||
* @param mutableAuthenticationDao
|
||||
* Mutable Authentication DAO
|
||||
*/
|
||||
public void setMutableAuthenticationDao(
|
||||
MutableAuthenticationDao mutableAuthenticationDao)
|
||||
{
|
||||
this.mutableAuthenticationDao = mutableAuthenticationDao;
|
||||
this.invitationService = invitationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user name generator service
|
||||
*
|
||||
* @param userNameGenerator
|
||||
* the user name generator
|
||||
*/
|
||||
public void setUserNameGenerator(UserNameGenerator userNameGenerator)
|
||||
{
|
||||
this.usernameGenerator = userNameGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the password generator service
|
||||
*
|
||||
* @param passwordGenerator
|
||||
* the password generator
|
||||
*/
|
||||
public void setPasswordGenerator(PasswordGenerator passwordGenerator)
|
||||
{
|
||||
this.passwordGenerator = passwordGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the site service property
|
||||
*
|
||||
* @param siteService
|
||||
* the site service to set
|
||||
*/
|
||||
public void setSiteService(SiteService siteService)
|
||||
{
|
||||
this.siteService = siteService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the node service property
|
||||
*
|
||||
* @param nodeService
|
||||
* the node service to set
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the namespace service property
|
||||
*
|
||||
* @param namespaceService
|
||||
* the namespace service to set
|
||||
*/
|
||||
public void setNamespaceService(NamespaceService namespaceService)
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the permission service
|
||||
*
|
||||
* @param permissionService the permission service
|
||||
*/
|
||||
public void setPermissionService(PermissionService permissionService)
|
||||
{
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
@@ -491,12 +353,4 @@ public class Invite extends DeclarativeWebScript
|
||||
model.put(MODEL_PROP_KEY_ACTION, ACTION_CANCEL);
|
||||
model.put(MODEL_PROP_KEY_INVITE_ID, inviteId);
|
||||
}
|
||||
|
||||
public void setInvitationService(InvitationService invitationService) {
|
||||
this.invitationService = invitationService;
|
||||
}
|
||||
|
||||
public InvitationService getInvitationService() {
|
||||
return invitationService;
|
||||
}
|
||||
}
|
||||
|
@@ -21,11 +21,10 @@ package org.alfresco.repo.web.scripts.invite;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
|
||||
import org.alfresco.repo.invitation.site.InviteHelper;
|
||||
import org.alfresco.repo.invitation.site.InviteInfo;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.template.TemplateNode;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.invitation.Invitation;
|
||||
import org.alfresco.service.cmr.invitation.InvitationExceptionNotFound;
|
||||
@@ -35,8 +34,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
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.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
@@ -51,33 +48,37 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
*/
|
||||
public class InviteByTicket extends DeclarativeWebScript
|
||||
{
|
||||
|
||||
// request parameter names
|
||||
private static final String PARAM_INVITEE_USER_NAME = "inviteeUserName";
|
||||
|
||||
// service instances
|
||||
private WorkflowService workflowService;
|
||||
private ServiceRegistry serviceRegistry;
|
||||
private SiteService siteService;
|
||||
private InvitationService invitationService;
|
||||
private TenantService tenantService;
|
||||
|
||||
/**
|
||||
* Set the workflow service property
|
||||
*
|
||||
* @param workflowService
|
||||
* the workflow service to set
|
||||
*/
|
||||
public void setWorkflowService(WorkflowService workflowService)
|
||||
|
||||
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
||||
{
|
||||
this.workflowService = workflowService;
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
}
|
||||
|
||||
public void setServiceRegistry(ServiceRegistry serviceRegistry) {
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
}
|
||||
|
||||
public void setSiteService(SiteService siteService) {
|
||||
|
||||
public void setInvitationService(InvitationService invitationService)
|
||||
{
|
||||
this.invitationService = invitationService;
|
||||
}
|
||||
|
||||
public void setSiteService(SiteService siteService)
|
||||
{
|
||||
this.siteService = siteService;
|
||||
}
|
||||
|
||||
/*
|
||||
public void setTenantService(TenantService tenantService)
|
||||
{
|
||||
this.tenantService = tenantService;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
@@ -86,19 +87,45 @@ public class InviteByTicket extends DeclarativeWebScript
|
||||
* org.alfresco.web.scripts.WebScriptResponse)
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, Object> executeImpl(WebScriptRequest req,
|
||||
Status status)
|
||||
protected Map<String, Object> executeImpl(final WebScriptRequest req, final Status status)
|
||||
{
|
||||
String tenantDomain = TenantService.DEFAULT_DOMAIN;
|
||||
|
||||
if (tenantService.isEnabled())
|
||||
{
|
||||
String inviteeUserName = req.getParameter(PARAM_INVITEE_USER_NAME);
|
||||
if (inviteeUserName != null)
|
||||
{
|
||||
tenantDomain = tenantService.getUserDomain(inviteeUserName);
|
||||
}
|
||||
}
|
||||
|
||||
// run as system user
|
||||
String mtAwareSystemUser = tenantService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain);
|
||||
|
||||
Map<String, Object> ret = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Map<String, Object>>()
|
||||
{
|
||||
public Map<String, Object> doWork() throws Exception
|
||||
{
|
||||
return execute(req, status);
|
||||
}
|
||||
}, mtAwareSystemUser);
|
||||
|
||||
// authenticate as system for the rest of the webscript
|
||||
AuthenticationUtil.setRunAsUser(mtAwareSystemUser);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private Map<String, Object> execute(WebScriptRequest req, Status status)
|
||||
{
|
||||
// initialise model to pass on for template to render
|
||||
Map<String, Object> model = new HashMap<String, Object>();
|
||||
|
||||
|
||||
// get inviteId and inviteTicket
|
||||
String inviteId = req.getServiceMatch().getTemplateVars().get("inviteId");
|
||||
String inviteTicket = req.getServiceMatch().getTemplateVars().get("inviteTicket");
|
||||
|
||||
// authenticate as system for the rest of the webscript
|
||||
AuthenticationUtil.setRunAsUserSystem();
|
||||
|
||||
try
|
||||
{
|
||||
Invitation invitation = invitationService.getInvitation(inviteId);
|
||||
@@ -129,15 +156,7 @@ public class InviteByTicket extends DeclarativeWebScript
|
||||
"No invite found for given id");
|
||||
}
|
||||
}
|
||||
|
||||
public void setInvitationService(InvitationService invitationService) {
|
||||
this.invitationService = invitationService;
|
||||
}
|
||||
|
||||
public InvitationService getInvitationService() {
|
||||
return invitationService;
|
||||
}
|
||||
|
||||
|
||||
private InviteInfo toInviteInfo(NominatedInvitation invitation)
|
||||
{
|
||||
final PersonService personService = serviceRegistry.getPersonService();
|
||||
|
@@ -21,16 +21,12 @@ package org.alfresco.repo.web.scripts.invite;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
|
||||
import org.alfresco.repo.invitation.site.InviteHelper;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.cmr.invitation.Invitation;
|
||||
import org.alfresco.service.cmr.invitation.InvitationExceptionForbidden;
|
||||
import org.alfresco.service.cmr.invitation.InvitationExceptionUserError;
|
||||
import org.alfresco.service.cmr.invitation.InvitationService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
@@ -53,34 +49,22 @@ public class InviteResponse extends DeclarativeWebScript
|
||||
|
||||
// request parameter names
|
||||
private static final String PARAM_INVITEE_USER_NAME = "inviteeUserName";
|
||||
|
||||
|
||||
// properties for services
|
||||
private WorkflowService workflowService;
|
||||
private InvitationService invitationService;
|
||||
private TenantService tenantService;
|
||||
|
||||
/**
|
||||
* Sets the workflow service property
|
||||
*
|
||||
* @param workflowService
|
||||
* the workflow service instance assign to the property
|
||||
*/
|
||||
public void setWorkflowService(WorkflowService workflowService)
|
||||
|
||||
|
||||
public void setInvitationService(InvitationService invitationService)
|
||||
{
|
||||
this.workflowService = workflowService;
|
||||
this.invitationService = invitationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tenant service property
|
||||
*
|
||||
* @param tenantService
|
||||
* the tenant service instance assign to the property
|
||||
*/
|
||||
public void setTenantService(TenantService tenantService)
|
||||
{
|
||||
this.tenantService = tenantService;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -92,32 +76,25 @@ public class InviteResponse extends DeclarativeWebScript
|
||||
@Override
|
||||
protected Map<String, Object> executeImpl(final WebScriptRequest req, final Status status)
|
||||
{
|
||||
String tenantDomain = TenantService.DEFAULT_DOMAIN;
|
||||
|
||||
if (tenantService.isEnabled())
|
||||
{
|
||||
final String tenantDomain;
|
||||
|
||||
String inviteeUserName = req.getParameter(PARAM_INVITEE_USER_NAME);
|
||||
if (inviteeUserName != null)
|
||||
{
|
||||
tenantDomain = tenantService.getUserDomain(inviteeUserName);
|
||||
}
|
||||
else
|
||||
{
|
||||
tenantDomain = "";
|
||||
}
|
||||
|
||||
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Map<String, Object>>()
|
||||
{
|
||||
public Map<String, Object> doWork() throws Exception
|
||||
{
|
||||
return execute(req, status);
|
||||
}
|
||||
}, tenantService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain));
|
||||
}
|
||||
else
|
||||
|
||||
// run as system user
|
||||
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Map<String, Object>>()
|
||||
{
|
||||
return execute(req, status);
|
||||
}
|
||||
public Map<String, Object> doWork() throws Exception
|
||||
{
|
||||
return execute(req, status);
|
||||
}
|
||||
}, tenantService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain));
|
||||
}
|
||||
|
||||
private Map<String, Object> execute(WebScriptRequest req, Status status)
|
||||
@@ -175,15 +152,7 @@ public class InviteResponse extends DeclarativeWebScript
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||
"action " + action + " is not supported by this webscript.");
|
||||
}
|
||||
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setInvitationService(InvitationService invitationService) {
|
||||
this.invitationService = invitationService;
|
||||
}
|
||||
|
||||
public InvitationService getInvitationService() {
|
||||
return invitationService;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user