mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix to Invite REST API where inviteeUserName arg was not correctly checked when inviting external users.
Also cleanup the related .js scripts to use spaces not tabs - significantly aids debugging in the script debugger. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13913 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* List/Search invitations implementation
|
* List/Search invitations implementation
|
||||||
*/
|
*/
|
||||||
|
function main()
|
||||||
function main ()
|
|
||||||
{
|
{
|
||||||
// Get the site id
|
// Get the site id
|
||||||
var urlElements = url.extension.split("/");
|
var urlElements = url.extension.split("/");
|
||||||
@@ -16,19 +15,19 @@ function main ()
|
|||||||
|
|
||||||
var props = {};
|
var props = {};
|
||||||
|
|
||||||
if(inviteeUserName != null)
|
if (inviteeUserName != null)
|
||||||
{
|
{
|
||||||
props.inviteeUserName = inviteeUserName
|
props.inviteeUserName = inviteeUserName
|
||||||
}
|
}
|
||||||
if(invitationType != null)
|
if (invitationType != null)
|
||||||
{
|
{
|
||||||
props.invitationType = invitationType
|
props.invitationType = invitationType
|
||||||
}
|
}
|
||||||
if(resourceType != null)
|
if (resourceType != null)
|
||||||
{
|
{
|
||||||
props.resourceType = resourceType
|
props.resourceType = resourceType
|
||||||
}
|
}
|
||||||
if(resourceName != null)
|
if (resourceName != null)
|
||||||
{
|
{
|
||||||
props.resourceName = resourceName
|
props.resourceName = resourceName
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
// Cancel invitation for a web site
|
/**
|
||||||
|
* Cancel invitation for a web site
|
||||||
|
*/
|
||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
// Get the url values
|
// Get the url values
|
||||||
@@ -16,7 +17,6 @@ function main()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Need to cancel an invitation here
|
// Need to cancel an invitation here
|
||||||
var invitation = site.getInvitation(inviteId);
|
var invitation = site.getInvitation(inviteId);
|
||||||
if (invitation == null)
|
if (invitation == null)
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Get the site id
|
// Get the site id
|
||||||
var urlElements = url.extension.split("/");
|
var urlElements = url.extension.split("/");
|
||||||
var shortName = urlElements[0];
|
var shortName = urlElements[0];
|
||||||
@@ -31,4 +30,3 @@ function main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
|
|
||||||
var invitation = null;
|
var invitation = null;
|
||||||
|
|
||||||
// Get the web site site
|
// Get the web site site
|
||||||
@@ -16,7 +15,7 @@ function main()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!json.has("invitationType"))
|
if (!json.has("invitationType"))
|
||||||
{
|
{
|
||||||
status.setCode(status.STATUS_BAD_REQUEST, "The invitationType has not been set.");
|
status.setCode(status.STATUS_BAD_REQUEST, "The invitationType has not been set.");
|
||||||
return;
|
return;
|
||||||
@@ -30,22 +29,22 @@ function main()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!invitationType.match("[MODERATED]|[NOMINATED]"))
|
if (!invitationType.match("[MODERATED]|[NOMINATED]"))
|
||||||
{
|
{
|
||||||
status.setCode(status.STATUS_BAD_REQUEST, "The invitationType has does not have a correct value.");
|
status.setCode(status.STATUS_BAD_REQUEST, "The invitationType has does not have a correct value.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(invitationType == "MODERATED")
|
if (invitationType == "MODERATED")
|
||||||
{
|
{
|
||||||
// Check mandatory parameters
|
// Check mandatory parameters
|
||||||
if(!json.has("inviteeRoleName"))
|
if (!json.has("inviteeRoleName"))
|
||||||
{
|
{
|
||||||
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeRoleName has not been set.");
|
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeRoleName has not been set.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!json.has("inviteeUserName"))
|
if (!json.has("inviteeUserName"))
|
||||||
{
|
{
|
||||||
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeUserName has not been set.");
|
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeUserName has not been set.");
|
||||||
return;
|
return;
|
||||||
@@ -76,17 +75,16 @@ function main()
|
|||||||
invitation = site.inviteModerated(inviteeComments, inviteeUserName, inviteeRoleName);
|
invitation = site.inviteModerated(inviteeComments, inviteeUserName, inviteeRoleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(invitationType == "NOMINATED")
|
if (invitationType == "NOMINATED")
|
||||||
{
|
{
|
||||||
|
// Get mandatory properties
|
||||||
// Get Mandatory properties
|
if (!json.has("inviteeRoleName"))
|
||||||
if(!json.has("inviteeRoleName"))
|
|
||||||
{
|
{
|
||||||
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeRoleName has not been set.");
|
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeRoleName has not been set.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var inviteeRoleName = json.get("inviteeRoleName");
|
var inviteeRoleName = json.get("inviteeRoleName");
|
||||||
if (inviteeRoleName == null || inviteeRoleName == "" )
|
if (inviteeRoleName == null || inviteeRoleName == "")
|
||||||
{
|
{
|
||||||
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeRoleName is null or empty.");
|
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeRoleName is null or empty.");
|
||||||
return;
|
return;
|
||||||
@@ -95,28 +93,25 @@ function main()
|
|||||||
var acceptUrl = json.get("acceptURL");
|
var acceptUrl = json.get("acceptURL");
|
||||||
var rejectUrl = json.get("rejectURL");
|
var rejectUrl = json.get("rejectURL");
|
||||||
|
|
||||||
/**
|
// Get the optional properties
|
||||||
* Get the optional properties
|
if (json.has("inviteeUserName") && json.get("inviteeUserName") != "")
|
||||||
*/
|
|
||||||
if(json.has("inviteeUserName"))
|
|
||||||
{
|
{
|
||||||
var inviteeUserName = json.get("inviteeUserName");
|
invitation = site.inviteNominated(json.get("inviteeUserName"), inviteeRoleName, serverPath, acceptUrl, rejectUrl);
|
||||||
invitation = site.inviteNominated(inviteeUserName, inviteeRoleName, serverPath, acceptUrl, rejectUrl);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Get Mandatory properties
|
// Get mandatory properties
|
||||||
if(!json.has("inviteeFirstName"))
|
if (!json.has("inviteeFirstName"))
|
||||||
{
|
{
|
||||||
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeFirstName has not been set.");
|
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeFirstName has not been set.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!json.has("inviteeLastName"))
|
if (!json.has("inviteeLastName"))
|
||||||
{
|
{
|
||||||
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeLastName has not been set.");
|
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeLastName has not been set.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!json.has("inviteeEmail"))
|
if (!json.has("inviteeEmail"))
|
||||||
{
|
{
|
||||||
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeEmail has not been set.");
|
status.setCode(status.STATUS_BAD_REQUEST, "The inviteeEmail has not been set.");
|
||||||
return;
|
return;
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* List invitations implementation
|
* List invitations implementation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function main ()
|
function main ()
|
||||||
{
|
{
|
||||||
// Get the site id
|
// Get the site id
|
||||||
@@ -22,11 +21,11 @@ function main ()
|
|||||||
|
|
||||||
var props = {};
|
var props = {};
|
||||||
|
|
||||||
if(inviteeUserName != null)
|
if (inviteeUserName != null)
|
||||||
{
|
{
|
||||||
props.inviteeUserName = inviteeUserName
|
props.inviteeUserName = inviteeUserName
|
||||||
}
|
}
|
||||||
if(invitationType != null)
|
if (invitationType != null)
|
||||||
{
|
{
|
||||||
props.invitationType = invitationType
|
props.invitationType = invitationType
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user