mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ALF-1973 Handle the case of a discussion post having been created by a user who has subsequently been deleted
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31294 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -3,12 +3,14 @@
|
|||||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||||
"${fieldName}":
|
"${fieldName}":
|
||||||
{
|
{
|
||||||
|
<#if person?has_content>
|
||||||
<#if person.assocs["cm:avatar"]??>
|
<#if person.assocs["cm:avatar"]??>
|
||||||
"avatarRef": "${person.assocs["cm:avatar"][0].nodeRef?string}",
|
"avatarRef": "${person.assocs["cm:avatar"][0].nodeRef?string}",
|
||||||
</#if>
|
</#if>
|
||||||
"username": "${person.properties["cm:userName"]}",
|
"username": "${person.properties["cm:userName"]}",
|
||||||
"firstName": "${person.properties["cm:firstName"]!""}",
|
"firstName": "${person.properties["cm:firstName"]!""}",
|
||||||
"lastName": "${person.properties["cm:lastName"]!""}"
|
"lastName": "${person.properties["cm:lastName"]!""}"
|
||||||
|
</#if>
|
||||||
},
|
},
|
||||||
</#escape>
|
</#escape>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
@@ -38,6 +38,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
|
import org.alfresco.service.cmr.security.NoSuchPersonException;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.service.cmr.site.SiteInfo;
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
@@ -272,15 +273,25 @@ public abstract class AbstractDiscussionWebScript extends DeclarativeWebScript
|
|||||||
|
|
||||||
protected Object buildPerson(String username)
|
protected Object buildPerson(String username)
|
||||||
{
|
{
|
||||||
|
// Empty string needed if the user can't be found
|
||||||
|
Object noSuchPersonResponse = "";
|
||||||
|
|
||||||
if (username == null || username.length() == 0)
|
if (username == null || username.length() == 0)
|
||||||
{
|
{
|
||||||
// Empty string needed
|
return noSuchPersonResponse;
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will turn into a Script Node needed of the person
|
try
|
||||||
NodeRef person = personService.getPerson(username);
|
{
|
||||||
return person;
|
// Will turn into a Script Node needed of the person
|
||||||
|
NodeRef person = personService.getPerson(username);
|
||||||
|
return person;
|
||||||
|
}
|
||||||
|
catch(NoSuchPersonException e)
|
||||||
|
{
|
||||||
|
// This is normally caused by the person having been deleted
|
||||||
|
return noSuchPersonResponse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user