mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- changed accept/reject webscripts to put method
- some code cleanup / removed obsolete invite.get.html.ftl git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10515 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
<#if action == "start">
|
|
||||||
<p>Invite to join site ${siteShortName} has been sent to ${inviteeUserName}</p>
|
|
||||||
<#elseif action == "cancel">
|
|
||||||
<p>Invite with ID ${inviteId} has been cancelled</p>
|
|
||||||
<#else>
|
|
||||||
<p>Error: unknown invite action ${action}</p>
|
|
||||||
</#if>
|
|
@@ -1,8 +0,0 @@
|
|||||||
<webscript>
|
|
||||||
<shortname>Invite reject</shortname>
|
|
||||||
<description>Rejects an invite</description>
|
|
||||||
<url>/api/invite/{inviteId}/{inviteTicket}</url>
|
|
||||||
<format default="json"/>
|
|
||||||
<authentication>none</authentication>
|
|
||||||
<transaction>required</transaction>
|
|
||||||
</webscript>
|
|
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"response" : "${response}",
|
|
||||||
"siteShortName" : "${siteShortName}"
|
|
||||||
}
|
|
@@ -1,7 +1,7 @@
|
|||||||
<webscript>
|
<webscript>
|
||||||
<shortname>Invite accept</shortname>
|
<shortname>Invite accept</shortname>
|
||||||
<description>Accepts an invite</description>
|
<description>Accepts an invite</description>
|
||||||
<url>/api/invite/{inviteId}/{inviteTicket}</url>
|
<url>/api/invite/{inviteId}/{inviteTicket}/{action}</url>
|
||||||
<format default="json"/>
|
<format default="json"/>
|
||||||
<authentication>none</authentication>
|
<authentication>none</authentication>
|
||||||
<transaction>required</transaction>
|
<transaction>required</transaction>
|
||||||
|
@@ -301,7 +301,7 @@
|
|||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- Invite Accept Web Script - accepts a pending invite -->
|
<!-- Invite Accept/Reject Web Script - accepts or rejects a pending invite -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
||||||
<bean id="webscript.org.alfresco.repository.invite.inviteresponse.put"
|
<bean id="webscript.org.alfresco.repository.invite.inviteresponse.put"
|
||||||
@@ -313,19 +313,6 @@
|
|||||||
<property name="personService" ref="personService"/>
|
<property name="personService" ref="personService"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- -->
|
|
||||||
<!-- Invite Reject Web Script - rejects a pending invite -->
|
|
||||||
<!-- -->
|
|
||||||
|
|
||||||
<bean id="webscript.org.alfresco.repository.invite.inviteresponse.delete"
|
|
||||||
class="org.alfresco.repo.web.scripts.invite.InviteResponse"
|
|
||||||
parent="webscript">
|
|
||||||
<property name="workflowService" ref="workflowServiceImpl"/>
|
|
||||||
<property name="mutableAuthenticationDao" ref="authenticationDao"/>
|
|
||||||
<property name="siteService" ref="siteService"/>
|
|
||||||
<property name="personService" ref="personService"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- Invites Web Script (pending invites) - returns pending invites matching the given -->
|
<!-- Invites Web Script (pending invites) - returns pending invites matching the given -->
|
||||||
<!-- inviter user name, invitee user name, site short name, or invite ID URL request parameters -->
|
<!-- inviter user name, invitee user name, site short name, or invite ID URL request parameters -->
|
||||||
|
@@ -86,17 +86,9 @@ public class InviteByTicket extends DeclarativeWebScript
|
|||||||
// initialise model to pass on for template to render
|
// initialise model to pass on for template to render
|
||||||
Map<String, Object> model = new HashMap<String, Object>();
|
Map<String, Object> model = new HashMap<String, Object>();
|
||||||
|
|
||||||
// Extract inviteId and inviteTicket
|
// get inviteId and inviteTicket
|
||||||
String extPath = req.getExtensionPath();
|
String inviteId = req.getServiceMatch().getTemplateVars().get("inviteId");
|
||||||
int separatorIndex = extPath.indexOf('/');
|
String inviteTicket = req.getServiceMatch().getTemplateVars().get("inviteTicket");
|
||||||
if (separatorIndex < 0)
|
|
||||||
{
|
|
||||||
// should not happen as descriptor would not match
|
|
||||||
throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR,
|
|
||||||
"Parameters missing");
|
|
||||||
}
|
|
||||||
String inviteId = extPath.substring(0, separatorIndex);
|
|
||||||
String inviteTicket = extPath.substring(separatorIndex + 1);
|
|
||||||
|
|
||||||
// authenticate as system for the rest of the webscript
|
// authenticate as system for the rest of the webscript
|
||||||
AuthenticationUtil.setSystemUserAsCurrentUser();
|
AuthenticationUtil.setSystemUserAsCurrentUser();
|
||||||
|
@@ -156,18 +156,6 @@ public class InviteResponse extends DeclarativeWebScript
|
|||||||
{
|
{
|
||||||
// initialise model to pass on for template to render
|
// initialise model to pass on for template to render
|
||||||
Map<String, Object> model = new HashMap<String, Object>();
|
Map<String, Object> model = new HashMap<String, Object>();
|
||||||
|
|
||||||
// Extract inviteId and inviteTicket
|
|
||||||
/*String extPath = req.getExtensionPath();
|
|
||||||
int separatorIndex = extPath.indexOf('/');
|
|
||||||
if (separatorIndex < 0)
|
|
||||||
{
|
|
||||||
// should not happen as descriptor would not match
|
|
||||||
throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR,
|
|
||||||
"Parameters missing");
|
|
||||||
}
|
|
||||||
String inviteId = extPath.substring(0, separatorIndex);
|
|
||||||
String inviteTicket = extPath.substring(separatorIndex + 1);*/
|
|
||||||
|
|
||||||
String inviteId = req.getServiceMatch().getTemplateVars().get("inviteId");
|
String inviteId = req.getServiceMatch().getTemplateVars().get("inviteId");
|
||||||
String inviteTicket = req.getServiceMatch().getTemplateVars().get("inviteTicket");
|
String inviteTicket = req.getServiceMatch().getTemplateVars().get("inviteTicket");
|
||||||
@@ -189,12 +177,12 @@ public class InviteResponse extends DeclarativeWebScript
|
|||||||
}
|
}
|
||||||
|
|
||||||
// process response
|
// process response
|
||||||
String method = req.getServiceMatch().getWebScript().getDescription().getMethod();
|
String action = req.getServiceMatch().getTemplateVars().get("action");
|
||||||
if (method.equals("PUT"))
|
if (action.equals("accept"))
|
||||||
{
|
{
|
||||||
acceptInvite(model, inviteId, inviteStartTask);
|
acceptInvite(model, inviteId, inviteStartTask);
|
||||||
}
|
}
|
||||||
else if (method.equals("DELETE"))
|
else if (action.equals("reject"))
|
||||||
{
|
{
|
||||||
rejectInvite(model, inviteId, inviteStartTask);
|
rejectInvite(model, inviteId, inviteStartTask);
|
||||||
}
|
}
|
||||||
@@ -202,7 +190,7 @@ public class InviteResponse extends DeclarativeWebScript
|
|||||||
{
|
{
|
||||||
/* handle unrecognised method */
|
/* handle unrecognised method */
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||||
"method " + method + " is not supported by this webscript.");
|
"action " + action + " is not supported by this webscript.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
|
@@ -501,7 +501,7 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
String inviteeUserName = result.getString("inviteeUserName");
|
String inviteeUserName = result.getString("inviteeUserName");
|
||||||
|
|
||||||
// Invitee accepts invitation to a Site from Inviter
|
// Invitee accepts invitation to a Site from Inviter
|
||||||
String acceptInviteUrl = URL_INVITE_SERVICE + "/" + inviteId + "/" + inviteTicket;
|
String acceptInviteUrl = URL_INVITE_SERVICE + "/" + inviteId + "/" + inviteTicket + "/accept";
|
||||||
MockHttpServletResponse response = putRequest(acceptInviteUrl,
|
MockHttpServletResponse response = putRequest(acceptInviteUrl,
|
||||||
Status.STATUS_OK, null, null);
|
Status.STATUS_OK, null, null);
|
||||||
|
|
||||||
@@ -535,9 +535,9 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
String inviteeUserName = result.getString("inviteeUserName");
|
String inviteeUserName = result.getString("inviteeUserName");
|
||||||
|
|
||||||
// Invitee rejects invitation to a Site from Inviter
|
// Invitee rejects invitation to a Site from Inviter
|
||||||
String rejectInviteUrl = URL_INVITE_SERVICE + "/" + inviteId + "/" + inviteTicket;
|
String rejectInviteUrl = URL_INVITE_SERVICE + "/" + inviteId + "/" + inviteTicket + "/reject";
|
||||||
MockHttpServletResponse response = deleteRequest(rejectInviteUrl,
|
MockHttpServletResponse response = putRequest(rejectInviteUrl,
|
||||||
Status.STATUS_OK);
|
Status.STATUS_OK, null, null);
|
||||||
|
|
||||||
//
|
//
|
||||||
// test that invite represented by invite ID (of invitation started
|
// test that invite represented by invite ID (of invitation started
|
||||||
|
Reference in New Issue
Block a user