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:
@@ -86,17 +86,9 @@ public class InviteByTicket extends DeclarativeWebScript
|
||||
// initialise model to pass on for template to render
|
||||
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);
|
||||
// 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.setSystemUserAsCurrentUser();
|
||||
|
@@ -156,18 +156,6 @@ public class InviteResponse extends DeclarativeWebScript
|
||||
{
|
||||
// initialise model to pass on for template to render
|
||||
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 inviteTicket = req.getServiceMatch().getTemplateVars().get("inviteTicket");
|
||||
@@ -189,12 +177,12 @@ public class InviteResponse extends DeclarativeWebScript
|
||||
}
|
||||
|
||||
// process response
|
||||
String method = req.getServiceMatch().getWebScript().getDescription().getMethod();
|
||||
if (method.equals("PUT"))
|
||||
String action = req.getServiceMatch().getTemplateVars().get("action");
|
||||
if (action.equals("accept"))
|
||||
{
|
||||
acceptInvite(model, inviteId, inviteStartTask);
|
||||
}
|
||||
else if (method.equals("DELETE"))
|
||||
else if (action.equals("reject"))
|
||||
{
|
||||
rejectInvite(model, inviteId, inviteStartTask);
|
||||
}
|
||||
@@ -202,7 +190,7 @@ public class InviteResponse extends DeclarativeWebScript
|
||||
{
|
||||
/* handle unrecognised method */
|
||||
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;
|
||||
|
@@ -501,7 +501,7 @@ public class InviteServiceTest extends BaseWebScriptTest
|
||||
String inviteeUserName = result.getString("inviteeUserName");
|
||||
|
||||
// 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,
|
||||
Status.STATUS_OK, null, null);
|
||||
|
||||
@@ -535,9 +535,9 @@ public class InviteServiceTest extends BaseWebScriptTest
|
||||
String inviteeUserName = result.getString("inviteeUserName");
|
||||
|
||||
// Invitee rejects invitation to a Site from Inviter
|
||||
String rejectInviteUrl = URL_INVITE_SERVICE + "/" + inviteId + "/" + inviteTicket;
|
||||
MockHttpServletResponse response = deleteRequest(rejectInviteUrl,
|
||||
Status.STATUS_OK);
|
||||
String rejectInviteUrl = URL_INVITE_SERVICE + "/" + inviteId + "/" + inviteTicket + "/reject";
|
||||
MockHttpServletResponse response = putRequest(rejectInviteUrl,
|
||||
Status.STATUS_OK, null, null);
|
||||
|
||||
//
|
||||
// test that invite represented by invite ID (of invitation started
|
||||
|
Reference in New Issue
Block a user