mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.0 to HEAD
11489: Added step for JDBC info 11490: Fixed: ETHREEOH-452 Error appear when a user trying to view metadata for item, which is deleting 11491: Blog integration package rename and removal of obsolete web-client beans 11492: Adding missing web-extension dir to dynamic-website project 11493: ETHREEOH_520: Fixes to prevent new users from being created when existing users invited to a site 11494: Updated version to beta2 11495: Fixes ETHREEOH-252, 392 & 393. When merged to 2.2 will also fix ETWOTWO-246 & 616 and when merged to HEAD will fix ALFCOM-1685 & 1712. 11496: Partial fix for ETHREEOH-27, fixes 2 out of the final 3 error conditions. 11497: Fix for ETHREEOH-550 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12447 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<webscript>
|
<webscript>
|
||||||
<shortname>Invite</shortname>
|
<shortname>Invite</shortname>
|
||||||
<description>Processes Inviter actions ('start' or 'cancel' invite)</description>
|
<description>Processes Inviter actions ('start' or 'cancel' invite)</description>
|
||||||
<url>/api/invite/start?inviteeFirstName={inviteeFirstName}&inviteeLastName={inviteeLastName}&inviteeEmail={inviteeEmailAddress}&siteShortName={siteShortName}&inviteeSiteRole={inviteeSiteRole}&serverPath={serverPath}&acceptUrl={acceptUrl}&rejectUrl={rejectUrl}</url>
|
<url>/api/invite/start?inviteeFirstName={inviteeFirstName}&inviteeLastName={inviteeLastName}&inviteeEmail={inviteeEmailAddress}&inviteeUserName={inviteeUserName?}&siteShortName={siteShortName}&inviteeSiteRole={inviteeSiteRole}&serverPath={serverPath}&acceptUrl={acceptUrl}&rejectUrl={rejectUrl}</url>
|
||||||
<url>/api/invite/cancel?inviteId={inviteId}</url>
|
<url>/api/invite/cancel?inviteId={inviteId}</url>
|
||||||
<format default="json"/>
|
<format default="json"/>
|
||||||
<authentication>user</authentication>
|
<authentication>user</authentication>
|
||||||
|
@@ -3,6 +3,7 @@ function main()
|
|||||||
{
|
{
|
||||||
|
|
||||||
var json = "";
|
var json = "";
|
||||||
|
var versions = [];
|
||||||
|
|
||||||
// allow for content to be loaded from id
|
// allow for content to be loaded from id
|
||||||
if(args["nodeRef"] != null)
|
if(args["nodeRef"] != null)
|
||||||
@@ -10,10 +11,8 @@ function main()
|
|||||||
var nodeRef = args["nodeRef"];
|
var nodeRef = args["nodeRef"];
|
||||||
node = search.findNode(nodeRef);
|
node = search.findNode(nodeRef);
|
||||||
|
|
||||||
var versions = null;
|
|
||||||
if (node != null)
|
if (node != null)
|
||||||
{
|
{
|
||||||
versions = [];
|
|
||||||
var versionHistory = node.versionHistory;
|
var versionHistory = node.versionHistory;
|
||||||
if(versionHistory != null)
|
if(versionHistory != null)
|
||||||
{
|
{
|
||||||
|
@@ -77,11 +77,11 @@ public class AVMRemoteStore extends BaseRemoteStore
|
|||||||
*/
|
*/
|
||||||
public void setRootPath(String rootPath)
|
public void setRootPath(String rootPath)
|
||||||
{
|
{
|
||||||
if(rootPath != null && rootPath.length() == 0)
|
if (rootPath != null && rootPath.length() == 0)
|
||||||
{
|
{
|
||||||
rootPath = "/";
|
rootPath = "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.rootPath = rootPath;
|
this.rootPath = rootPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ public class AVMRemoteStore extends BaseRemoteStore
|
|||||||
{
|
{
|
||||||
this.avmService = avmService;
|
this.avmService = avmService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param searchService the SearchService to set
|
* @param searchService the SearchService to set
|
||||||
*/
|
*/
|
||||||
@@ -374,15 +374,6 @@ public class AVMRemoteStore extends BaseRemoteStore
|
|||||||
{
|
{
|
||||||
if (n.isFile())
|
if (n.isFile())
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
String myPath = n.getPath();
|
|
||||||
String origPath = node.getPath();
|
|
||||||
|
|
||||||
String toWrite = myPath.substring(origPath.length());
|
|
||||||
out.write(toWrite);
|
|
||||||
out.write("\n");
|
|
||||||
*/
|
|
||||||
|
|
||||||
out.write(n.getPath().substring(cropPoint));
|
out.write(n.getPath().substring(cropPoint));
|
||||||
out.write("\n");
|
out.write("\n");
|
||||||
}
|
}
|
||||||
@@ -417,18 +408,11 @@ public class AVMRemoteStore extends BaseRemoteStore
|
|||||||
|
|
||||||
String encPath = RepoStore.encodePathISO9075(path);
|
String encPath = RepoStore.encodePathISO9075(path);
|
||||||
final StringBuilder query = new StringBuilder(128);
|
final StringBuilder query = new StringBuilder(128);
|
||||||
|
|
||||||
query.append("+PATH:\"").append(this.rootPath)
|
query.append("+PATH:\"").append(this.rootPath)
|
||||||
.append(encPath.length() != 0 ? ('/' + encPath) : "")
|
|
||||||
.append("//*\" +QNAME:")
|
|
||||||
.append(pattern);
|
|
||||||
|
|
||||||
/*
|
|
||||||
query.append("+PATH:\"/").append(this.rootPath)
|
|
||||||
.append(encPath.length() != 0 ? ('/' + encPath) : "")
|
.append(encPath.length() != 0 ? ('/' + encPath) : "")
|
||||||
.append("//*\" +QNAME:")
|
.append("//*\" +QNAME:")
|
||||||
.append(pattern);
|
.append(pattern);
|
||||||
*/
|
|
||||||
|
|
||||||
final Writer out = res.getWriter();
|
final Writer out = res.getWriter();
|
||||||
final StoreRef avmStore = new StoreRef(StoreRef.PROTOCOL_AVM + StoreRef.URI_FILLER + store);
|
final StoreRef avmStore = new StoreRef(StoreRef.PROTOCOL_AVM + StoreRef.URI_FILLER + store);
|
||||||
@@ -470,11 +454,109 @@ public class AVMRemoteStore extends BaseRemoteStore
|
|||||||
*/
|
*/
|
||||||
private String buildAVMPath(String store, String path)
|
private String buildAVMPath(String store, String path)
|
||||||
{
|
{
|
||||||
//return store + ":/" + this.rootPath + (path != null ? ("/" + path) : "");
|
if (path.startsWith("/"))
|
||||||
if(path.startsWith("/"))
|
{
|
||||||
{
|
path = path.substring(1);
|
||||||
path = path.substring(1);
|
}
|
||||||
}
|
return store + ":" + this.rootPath + (path != null ? encodePath(path) : "");
|
||||||
return store + ":" + this.rootPath + (path != null ? path : "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static String encodePath(final String s)
|
||||||
|
{
|
||||||
|
StringBuilder sb = null; //create on demand
|
||||||
|
char ch;
|
||||||
|
final int len = s.length();
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
ch = s.charAt(i);
|
||||||
|
|
||||||
|
if (('A' <= ch && ch <= 'Z') || // 'A'..'Z'
|
||||||
|
('a' <= ch && ch <= 'z') || // 'a'..'z'
|
||||||
|
('0' <= ch && ch <= '9') || // '0'..'9'
|
||||||
|
ch == '/' ||
|
||||||
|
ch == '\'' || ch == ' ' ||
|
||||||
|
ch == '.' || ch == '~' ||
|
||||||
|
ch == '-' || ch == '_' ||
|
||||||
|
ch == '@' || ch == '!' ||
|
||||||
|
ch == '(' || ch == ')' ||
|
||||||
|
ch == ';' || ch == ',' ||
|
||||||
|
ch == '+' || ch == '$')
|
||||||
|
{
|
||||||
|
if (sb != null)
|
||||||
|
{
|
||||||
|
sb.append(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((int)ch <= 0x007f) // other ASCII
|
||||||
|
{
|
||||||
|
if (sb == null)
|
||||||
|
{
|
||||||
|
final String soFar = s.substring(0, i);
|
||||||
|
sb = new StringBuilder(len + 16);
|
||||||
|
sb.append(soFar);
|
||||||
|
}
|
||||||
|
sb.append(hex[ch]);
|
||||||
|
}
|
||||||
|
else if ((int)ch <= 0x07FF) // non-ASCII <= 0x7FF
|
||||||
|
{
|
||||||
|
if (sb == null)
|
||||||
|
{
|
||||||
|
final String soFar = s.substring(0, i);
|
||||||
|
sb = new StringBuilder(len + 16);
|
||||||
|
sb.append(soFar);
|
||||||
|
}
|
||||||
|
sb.append(hex[0xc0 | (ch >> 6)]);
|
||||||
|
sb.append(hex[0x80 | (ch & 0x3F)]);
|
||||||
|
}
|
||||||
|
else // 0x7FF < ch <= 0xFFFF
|
||||||
|
{
|
||||||
|
if (sb == null)
|
||||||
|
{
|
||||||
|
final String soFar = s.substring(0, i);
|
||||||
|
sb = new StringBuilder(len + 16);
|
||||||
|
sb.append(soFar);
|
||||||
|
}
|
||||||
|
sb.append(hex[0xe0 | (ch >> 12)]);
|
||||||
|
sb.append(hex[0x80 | ((ch >> 6) & 0x3F)]);
|
||||||
|
sb.append(hex[0x80 | (ch & 0x3F)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (sb != null ? sb.toString() : s);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static String[] hex = {
|
||||||
|
"%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
|
||||||
|
"%08", "%09", "%0a", "%0b", "%0c", "%0d", "%0e", "%0f",
|
||||||
|
"%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
|
||||||
|
"%18", "%19", "%1a", "%1b", "%1c", "%1d", "%1e", "%1f",
|
||||||
|
"%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27",
|
||||||
|
"%28", "%29", "%2a", "%2b", "%2c", "%2d", "%2e", "%2f",
|
||||||
|
"%30", "%31", "%32", "%33", "%34", "%35", "%36", "%37",
|
||||||
|
"%38", "%39", "%3a", "%3b", "%3c", "%3d", "%3e", "%3f",
|
||||||
|
"%40", "%41", "%42", "%43", "%44", "%45", "%46", "%47",
|
||||||
|
"%48", "%49", "%4a", "%4b", "%4c", "%4d", "%4e", "%4f",
|
||||||
|
"%50", "%51", "%52", "%53", "%54", "%55", "%56", "%57",
|
||||||
|
"%58", "%59", "%5a", "%5b", "%5c", "%5d", "%5e", "%5f",
|
||||||
|
"%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67",
|
||||||
|
"%68", "%69", "%6a", "%6b", "%6c", "%6d", "%6e", "%6f",
|
||||||
|
"%70", "%71", "%72", "%73", "%74", "%75", "%76", "%77",
|
||||||
|
"%78", "%79", "%7a", "%7b", "%7c", "%7d", "%7e", "%7f",
|
||||||
|
"%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87",
|
||||||
|
"%88", "%89", "%8a", "%8b", "%8c", "%8d", "%8e", "%8f",
|
||||||
|
"%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97",
|
||||||
|
"%98", "%99", "%9a", "%9b", "%9c", "%9d", "%9e", "%9f",
|
||||||
|
"%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%a7",
|
||||||
|
"%a8", "%a9", "%aa", "%ab", "%ac", "%ad", "%ae", "%af",
|
||||||
|
"%b0", "%b1", "%b2", "%b3", "%b4", "%b5", "%b6", "%b7",
|
||||||
|
"%b8", "%b9", "%ba", "%bb", "%bc", "%bd", "%be", "%bf",
|
||||||
|
"%c0", "%c1", "%c2", "%c3", "%c4", "%c5", "%c6", "%c7",
|
||||||
|
"%c8", "%c9", "%ca", "%cb", "%cc", "%cd", "%ce", "%cf",
|
||||||
|
"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",
|
||||||
|
"%d8", "%d9", "%da", "%db", "%dc", "%dd", "%de", "%df",
|
||||||
|
"%e0", "%e1", "%e2", "%e3", "%e4", "%e5", "%e6", "%e7",
|
||||||
|
"%e8", "%e9", "%ea", "%eb", "%ec", "%ed", "%ee", "%ef",
|
||||||
|
"%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7",
|
||||||
|
"%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@@ -32,10 +32,10 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
|
||||||
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||||
import org.alfresco.repo.security.authentication.PasswordGenerator;
|
import org.alfresco.repo.security.authentication.PasswordGenerator;
|
||||||
import org.alfresco.repo.security.authentication.UserNameGenerator;
|
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.site.SiteModel;
|
||||||
import org.alfresco.repo.site.SiteService;
|
import org.alfresco.repo.site.SiteService;
|
||||||
import org.alfresco.repo.workflow.WorkflowModel;
|
import org.alfresco.repo.workflow.WorkflowModel;
|
||||||
@@ -52,6 +52,7 @@ import org.alfresco.service.cmr.workflow.WorkflowTask;
|
|||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
|
import org.alfresco.web.scripts.Cache;
|
||||||
import org.alfresco.web.scripts.DeclarativeWebScript;
|
import org.alfresco.web.scripts.DeclarativeWebScript;
|
||||||
import org.alfresco.web.scripts.Status;
|
import org.alfresco.web.scripts.Status;
|
||||||
import org.alfresco.web.scripts.WebScriptException;
|
import org.alfresco.web.scripts.WebScriptException;
|
||||||
@@ -78,6 +79,7 @@ public class Invite extends DeclarativeWebScript
|
|||||||
private static final String MODEL_PROP_KEY_INVITEE_LASTNAME = "inviteeLastName";
|
private static final String MODEL_PROP_KEY_INVITEE_LASTNAME = "inviteeLastName";
|
||||||
private static final String MODEL_PROP_KEY_INVITEE_EMAIL = "inviteeEmail";
|
private static final String MODEL_PROP_KEY_INVITEE_EMAIL = "inviteeEmail";
|
||||||
private static final String MODEL_PROP_KEY_SITE_SHORT_NAME = "siteShortName";
|
private static final String MODEL_PROP_KEY_SITE_SHORT_NAME = "siteShortName";
|
||||||
|
private static final String MODEL_PROP_KEY_INVITEE_USERNAME = "inviteeUserName";
|
||||||
|
|
||||||
// URL request parameter names
|
// URL request parameter names
|
||||||
private static final String PARAM_INVITEE_FIRSTNAME = "inviteeFirstName";
|
private static final String PARAM_INVITEE_FIRSTNAME = "inviteeFirstName";
|
||||||
@@ -217,8 +219,7 @@ public class Invite extends DeclarativeWebScript
|
|||||||
* org.alfresco.web.scripts.WebScriptResponse)
|
* org.alfresco.web.scripts.WebScriptResponse)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, Object> executeImpl(WebScriptRequest req,
|
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||||
Status status)
|
|
||||||
{
|
{
|
||||||
// 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>();
|
||||||
@@ -254,7 +255,7 @@ public class Invite extends DeclarativeWebScript
|
|||||||
{
|
{
|
||||||
// check for 'inviteeFirstName' parameter not provided
|
// check for 'inviteeFirstName' parameter not provided
|
||||||
String inviteeFirstName = req.getParameter(PARAM_INVITEE_FIRSTNAME);
|
String inviteeFirstName = req.getParameter(PARAM_INVITEE_FIRSTNAME);
|
||||||
if ((inviteeFirstName == null) || (inviteeFirstName.length() == 0))
|
if ((inviteeFirstName == null) || (inviteeFirstName.trim().length() == 0))
|
||||||
{
|
{
|
||||||
// handle inviteeFirstName URL parameter not provided
|
// handle inviteeFirstName URL parameter not provided
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||||
@@ -265,7 +266,7 @@ public class Invite extends DeclarativeWebScript
|
|||||||
|
|
||||||
// check for 'inviteeLastName' parameter not provided
|
// check for 'inviteeLastName' parameter not provided
|
||||||
String inviteeLastName = req.getParameter(PARAM_INVITEE_LASTNAME);
|
String inviteeLastName = req.getParameter(PARAM_INVITEE_LASTNAME);
|
||||||
if ((inviteeLastName == null) || (inviteeLastName.length() == 0))
|
if ((inviteeLastName == null) || (inviteeLastName.trim().length() == 0))
|
||||||
{
|
{
|
||||||
// handle inviteeLastName URL parameter not provided
|
// handle inviteeLastName URL parameter not provided
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||||
@@ -276,7 +277,7 @@ public class Invite extends DeclarativeWebScript
|
|||||||
|
|
||||||
// check for 'inviteeEmail' parameter not provided
|
// check for 'inviteeEmail' parameter not provided
|
||||||
String inviteeEmail = req.getParameter(PARAM_INVITEE_EMAIL);
|
String inviteeEmail = req.getParameter(PARAM_INVITEE_EMAIL);
|
||||||
if ((inviteeEmail == null) || (inviteeEmail.length() == 0))
|
if ((inviteeEmail == null) || (inviteeEmail.trim().length() == 0))
|
||||||
{
|
{
|
||||||
// handle inviteeEmail URL parameter not provided
|
// handle inviteeEmail URL parameter not provided
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||||
@@ -287,7 +288,7 @@ public class Invite extends DeclarativeWebScript
|
|||||||
|
|
||||||
// check for 'siteShortName' parameter not provided
|
// check for 'siteShortName' parameter not provided
|
||||||
String siteShortName = req.getParameter(PARAM_SITE_SHORT_NAME);
|
String siteShortName = req.getParameter(PARAM_SITE_SHORT_NAME);
|
||||||
if ((siteShortName == null) || (siteShortName.length() == 0))
|
if ((siteShortName == null) || (siteShortName.trim().length() == 0))
|
||||||
{
|
{
|
||||||
// handle siteShortName URL parameter not provided
|
// handle siteShortName URL parameter not provided
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||||
@@ -298,7 +299,7 @@ public class Invite extends DeclarativeWebScript
|
|||||||
|
|
||||||
// check for 'inviteeSiteRole' parameter not provided
|
// check for 'inviteeSiteRole' parameter not provided
|
||||||
String inviteeSiteRole = req.getParameter(PARAM_INVITEE_SITE_ROLE);
|
String inviteeSiteRole = req.getParameter(PARAM_INVITEE_SITE_ROLE);
|
||||||
if ((inviteeSiteRole == null) || (inviteeSiteRole.length() == 0))
|
if ((inviteeSiteRole == null) || (inviteeSiteRole.trim().length() == 0))
|
||||||
{
|
{
|
||||||
// handle inviteeSiteRole URL parameter not provided
|
// handle inviteeSiteRole URL parameter not provided
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||||
@@ -308,7 +309,7 @@ public class Invite extends DeclarativeWebScript
|
|||||||
|
|
||||||
// check for 'serverPath' parameter not provided
|
// check for 'serverPath' parameter not provided
|
||||||
String serverPath = req.getParameter(PARAM_SERVER_PATH);
|
String serverPath = req.getParameter(PARAM_SERVER_PATH);
|
||||||
if ((serverPath == null) || (serverPath.length() == 0))
|
if ((serverPath == null) || (serverPath.trim().length() == 0))
|
||||||
{
|
{
|
||||||
// handle serverPath URL parameter not provided
|
// handle serverPath URL parameter not provided
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||||
@@ -318,7 +319,7 @@ public class Invite extends DeclarativeWebScript
|
|||||||
|
|
||||||
// check for 'acceptUrl' parameter not provided
|
// check for 'acceptUrl' parameter not provided
|
||||||
String acceptUrl = req.getParameter(PARAM_ACCEPT_URL);
|
String acceptUrl = req.getParameter(PARAM_ACCEPT_URL);
|
||||||
if ((acceptUrl == null) || (acceptUrl.length() == 0))
|
if ((acceptUrl == null) || (acceptUrl.trim().length() == 0))
|
||||||
{
|
{
|
||||||
// handle acceptUrl URL parameter not provided
|
// handle acceptUrl URL parameter not provided
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||||
@@ -328,16 +329,19 @@ public class Invite extends DeclarativeWebScript
|
|||||||
|
|
||||||
// check for 'rejectUrl' parameter not provided
|
// check for 'rejectUrl' parameter not provided
|
||||||
String rejectUrl = req.getParameter(PARAM_REJECT_URL);
|
String rejectUrl = req.getParameter(PARAM_REJECT_URL);
|
||||||
if ((rejectUrl == null) || (rejectUrl.length() == 0))
|
if ((rejectUrl == null) || (rejectUrl.trim().length() == 0))
|
||||||
{
|
{
|
||||||
// handle rejectUrl URL parameter not provided
|
// handle rejectUrl URL parameter not provided
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||||
"'rejectUrl' parameter has not been provided in URL for action '"
|
"'rejectUrl' parameter has not been provided in URL for action '"
|
||||||
+ ACTION_START + "'");
|
+ ACTION_START + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check for the invitee user name (if present)
|
||||||
|
String inviteeUserName = req.getParameter(MODEL_PROP_KEY_INVITEE_USERNAME);
|
||||||
|
|
||||||
// process action 'start' with provided parameters
|
// process action 'start' with provided parameters
|
||||||
startInvite(model, inviteeFirstName, inviteeLastName, inviteeEmail, siteShortName, inviteeSiteRole, serverPath, acceptUrl, rejectUrl);
|
startInvite(model, inviteeFirstName, inviteeLastName, inviteeEmail, inviteeUserName, siteShortName, inviteeSiteRole, serverPath, acceptUrl, rejectUrl);
|
||||||
}
|
}
|
||||||
// else handle if provided 'action' is 'cancel'
|
// else handle if provided 'action' is 'cancel'
|
||||||
else if (action.equals(ACTION_CANCEL))
|
else if (action.equals(ACTION_CANCEL))
|
||||||
@@ -500,7 +504,7 @@ public class Invite extends DeclarativeWebScript
|
|||||||
* externally accessible server address of server hosting invite web scripts
|
* externally accessible server address of server hosting invite web scripts
|
||||||
*/
|
*/
|
||||||
private void startInvite(Map<String, Object> model, String inviteeFirstName, String inviteeLastName,
|
private void startInvite(Map<String, Object> model, String inviteeFirstName, String inviteeLastName,
|
||||||
String inviteeEmail, String siteShortName, String inviteeSiteRole, String serverPath, String acceptUrl, String rejectUrl)
|
String inviteeEmail, String inviteeUserName, String siteShortName, String inviteeSiteRole, String serverPath, String acceptUrl, String rejectUrl)
|
||||||
{
|
{
|
||||||
// get the inviter user name (the name of user web script is executed under)
|
// get the inviter user name (the name of user web script is executed under)
|
||||||
// - needs to be assigned here because various system calls further on
|
// - needs to be assigned here because various system calls further on
|
||||||
@@ -518,6 +522,8 @@ public class Invite extends DeclarativeWebScript
|
|||||||
+ inviterRole + "'");
|
+ inviterRole + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// if we have not explicitly been passed an existing user's user name then ....
|
||||||
//
|
//
|
||||||
// if a person already exists who has the given invitee email address
|
// if a person already exists who has the given invitee email address
|
||||||
//
|
//
|
||||||
@@ -525,47 +531,38 @@ public class Invite extends DeclarativeWebScript
|
|||||||
// should only be one)
|
// should only be one)
|
||||||
// 2) handle error conditions - (invitee already has an invitation in progress for the given site,
|
// 2) handle error conditions - (invitee already has an invitation in progress for the given site,
|
||||||
// or he/she is already a member of the given site
|
// or he/she is already a member of the given site
|
||||||
//
|
//
|
||||||
Set<NodeRef> peopleWithInviteeEmail = this.personService.getPeopleFilteredByProperty(
|
if (inviteeUserName == null || inviteeUserName.trim().length() == 0)
|
||||||
ContentModel.PROP_EMAIL, inviteeEmail);
|
|
||||||
String inviteeUserName;
|
|
||||||
if (peopleWithInviteeEmail.isEmpty() == false)
|
|
||||||
{
|
{
|
||||||
// get person already existing who has the given
|
Set<NodeRef> peopleWithInviteeEmail = this.personService.getPeopleFilteredByProperty(
|
||||||
// invitee email address (there should only be one, so just take
|
ContentModel.PROP_EMAIL, inviteeEmail);
|
||||||
// the first from the set of people).
|
if (peopleWithInviteeEmail.isEmpty() == false)
|
||||||
NodeRef person = (NodeRef) peopleWithInviteeEmail.toArray()[0];
|
|
||||||
|
|
||||||
// get invitee user name of that person
|
|
||||||
|
|
||||||
Serializable userNamePropertyVal = this.nodeService.getProperty(
|
|
||||||
person, ContentModel.PROP_USERNAME);
|
|
||||||
inviteeUserName = DefaultTypeConverter.INSTANCE.convert(String.class, userNamePropertyVal);
|
|
||||||
|
|
||||||
// throw web script exception if person is already a member of the given site
|
|
||||||
if (this.siteService.isMember(siteShortName, inviteeUserName))
|
|
||||||
{
|
{
|
||||||
throw new WebScriptException(Status.STATUS_CONFLICT,
|
// get person already existing who has the given
|
||||||
"Cannot proceed with invitation. A person with user name: '" + inviteeUserName
|
// invitee email address (there should only be one, so just take
|
||||||
+ "' and invitee email address: '"
|
// the first from the set of people).
|
||||||
+ inviteeEmail + "' is already a member of the site: '" + siteShortName + "'.");
|
NodeRef person = (NodeRef) peopleWithInviteeEmail.toArray()[0];
|
||||||
|
|
||||||
|
// get invitee user name of that person
|
||||||
|
Serializable userNamePropertyVal = this.nodeService.getProperty(
|
||||||
|
person, ContentModel.PROP_USERNAME);
|
||||||
|
inviteeUserName = DefaultTypeConverter.INSTANCE.convert(String.class, userNamePropertyVal);
|
||||||
|
}
|
||||||
|
// else there are no existing people who have the given invitee email address
|
||||||
|
// so create invitee person
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inviteeUserName = createInviteePerson(inviteeFirstName, inviteeLastName, inviteeEmail);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if an there is already an invite being processed for the person
|
|
||||||
// then throw a web script exception
|
|
||||||
// if (isInviteAlreadyInProgress(inviteeUserName, siteShortName))
|
|
||||||
// {
|
|
||||||
// throw new WebScriptException(Status.STATUS_CONFLICT,
|
|
||||||
// "Cannot proceed with invitation. There is already an invitation in progress " +
|
|
||||||
// "for a person with user name: '" + inviteeUserName + "' and invitee email address: '"
|
|
||||||
// + inviteeEmail + "' who is already a member of the site: '" + siteShortName + "'.");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
// else there are no existing people who have the given invitee email address
|
|
||||||
// so create invitee person
|
// throw web script exception if person is already a member of the given site
|
||||||
else
|
if (this.siteService.isMember(siteShortName, inviteeUserName))
|
||||||
{
|
{
|
||||||
inviteeUserName = createInviteePerson(inviteeFirstName, inviteeLastName, inviteeEmail);
|
throw new WebScriptException(Status.STATUS_CONFLICT,
|
||||||
|
"Cannot proceed with invitation. A person with user name: '" + inviteeUserName
|
||||||
|
+ "' and invitee email address: '"
|
||||||
|
+ inviteeEmail + "' is already a member of the site: '" + siteShortName + "'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -52,6 +52,7 @@ import org.alfresco.service.cmr.workflow.WorkflowInstance;
|
|||||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
|
import org.alfresco.util.GUID;
|
||||||
import org.alfresco.util.PropertyMap;
|
import org.alfresco.util.PropertyMap;
|
||||||
import org.alfresco.util.URLEncoder;
|
import org.alfresco.util.URLEncoder;
|
||||||
import org.alfresco.web.scripts.Status;
|
import org.alfresco.web.scripts.Status;
|
||||||
@@ -291,6 +292,12 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
this.authorityService.deleteAuthority(fullGroupName);
|
this.authorityService.deleteAuthority(fullGroupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String PERSON_FIRSTNAME = "FirstName123";
|
||||||
|
public static String PERSON_LASTNAME = "LastName123";
|
||||||
|
public static String PERSON_JOBTITLE = "JobTitle123";
|
||||||
|
public static String PERSON_ORG = "Organisation123";
|
||||||
|
|
||||||
|
|
||||||
private void createPerson(String userName, String emailAddress)
|
private void createPerson(String userName, String emailAddress)
|
||||||
{
|
{
|
||||||
// if user with given user name doesn't already exist then create user
|
// if user with given user name doesn't already exist then create user
|
||||||
@@ -308,11 +315,11 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
// create person properties
|
// create person properties
|
||||||
PropertyMap personProps = new PropertyMap();
|
PropertyMap personProps = new PropertyMap();
|
||||||
personProps.put(ContentModel.PROP_USERNAME, userName);
|
personProps.put(ContentModel.PROP_USERNAME, userName);
|
||||||
personProps.put(ContentModel.PROP_FIRSTNAME, "FirstName123");
|
personProps.put(ContentModel.PROP_FIRSTNAME, PERSON_FIRSTNAME);
|
||||||
personProps.put(ContentModel.PROP_LASTNAME, "LastName123");
|
personProps.put(ContentModel.PROP_LASTNAME, PERSON_LASTNAME);
|
||||||
personProps.put(ContentModel.PROP_EMAIL, emailAddress);
|
personProps.put(ContentModel.PROP_EMAIL, emailAddress);
|
||||||
personProps.put(ContentModel.PROP_JOBTITLE, "JobTitle123");
|
personProps.put(ContentModel.PROP_JOBTITLE, PERSON_JOBTITLE);
|
||||||
personProps.put(ContentModel.PROP_JOBTITLE, "Organisation123");
|
personProps.put(ContentModel.PROP_ORGANIZATION, PERSON_ORG);
|
||||||
|
|
||||||
// create person node for user
|
// create person node for user
|
||||||
this.personService.createPerson(personProps);
|
this.personService.createPerson(personProps);
|
||||||
@@ -794,4 +801,29 @@ public class InviteServiceTest extends BaseWebScriptTest
|
|||||||
|
|
||||||
assertEquals(true, inviteePersonExists);
|
assertEquals(true, inviteePersonExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://issues.alfresco.com/jira/browse/ETHREEOH-520
|
||||||
|
*/
|
||||||
|
public void testETHREEOH_520()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
final String userName = "userInviteServiceTest" + GUID.generate();
|
||||||
|
final String emailAddress = " ";
|
||||||
|
|
||||||
|
// Create a person with a blank email address and
|
||||||
|
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
||||||
|
{
|
||||||
|
public Object doWork() throws Exception
|
||||||
|
{
|
||||||
|
createPerson(userName, " ");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
|
// Try and add an existing person to the site with no email address
|
||||||
|
// Should return bad request since the email address has not been provided
|
||||||
|
startInvite(PERSON_FIRSTNAME, PERSON_LASTNAME, emailAddress, INVITEE_SITE_ROLE, SITE_SHORT_NAME_INVITE_1, 400);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user