MT Share - initial checkpoint

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13459 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2009-03-03 22:25:50 +00:00
parent b870fe9d59
commit 626235a9dc
5 changed files with 233 additions and 184 deletions

View File

@@ -2,6 +2,7 @@
<shortname>Invite by ticket</shortname>
<description>Returns invite information for a given inviteId and inviteTicket. No authentication is required</description>
<url>/api/invite/{inviteId}/{inviteTicket}</url>
<url>/api/invite/{inviteId}/{inviteTicket}?inviteeUserName={inviteeUserName?}</url>
<format default="json"/>
<authentication>none</authentication>
<transaction>required</transaction>

View File

@@ -2,7 +2,7 @@
<shortname>Membership</shortname>
<description>Get the membership details for a user</description>
<url>/api/sites/{shortname}/memberships/{username}</url>
<format default="json"/>
<format default="json">argument</format>
<authentication>user</authentication>
<transaction>required</transaction>
</webscript>

View File

@@ -7,7 +7,7 @@
<url>/remotestore/{method}/s/{store}/{path}</url>
<url>/remotestore/{method}/s/{store}/w/{webapp}</url>
<url>/remotestore/{method}/s/{store}/w/{webapp}/{path}</url>
<authentication>none</authentication>
<authentication>guest</authentication>
<transaction>required</transaction>
<format default="">argument</format>
</webscript>

View File

@@ -371,6 +371,7 @@
class="org.alfresco.repo.web.scripts.invite.InviteResponse"
parent="webscript">
<property name="workflowService" ref="WorkflowService"/>
<property name="tenantService" ref="tenantService"/>
</bean>
<!-- -->

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -29,6 +29,8 @@ 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.workflow.WorkflowService;
import org.alfresco.service.cmr.workflow.WorkflowTask;
import org.alfresco.web.scripts.DeclarativeWebScript;
@@ -51,9 +53,14 @@ public class InviteResponse extends DeclarativeWebScript
private static final String MODEL_PROP_KEY_RESPONSE = "response";
private static final String MODEL_PROP_KEY_SITE_SHORT_NAME = "siteShortName";
// request parameter names
private static final String PARAM_INVITEE_USER_NAME = "inviteeUserName";
// properties for services
private WorkflowService workflowService;
private TenantService tenantService;
/**
* Sets the workflow service property
*
@@ -65,6 +72,17 @@ public class InviteResponse extends DeclarativeWebScript
this.workflowService = workflowService;
}
/**
* 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)
*
@@ -74,8 +92,37 @@ public class InviteResponse 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)
{
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
{
return execute(req, status);
}
}
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>();