Merged V3.2 to HEAD

16700: Fix for ETHREEOH-2509 - Leaving a private site breaks All Sites search for any term found in documents user created in that site.
   16703: Fix for ETHREEOH-2775 - "Show all" fails for user if permissions of folder that item was deleted from are changed to exclude them.
   16705: Fixes to Site Links dashlet component.
   16707: Fixed ETHREEOH-619 "User who is already a member of the site (or invite is pending) can be added to the invite list"

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16899 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2009-10-14 09:55:04 +00:00
parent 85c1b71826
commit e2626e2cb3

View File

@@ -322,10 +322,6 @@ public class SiteServiceImpl implements SiteService, SiteModel
/** /**
* Check that the site does not already exist * Check that the site does not already exist
*/ */
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
{
public String doWork() throws Exception
{
// Check to see if we already have a site of this name // Check to see if we already have a site of this name
NodeRef existingSite = getSiteNodeRef(shortName); NodeRef existingSite = getSiteNodeRef(shortName);
if (existingSite != null) if (existingSite != null)
@@ -333,9 +329,6 @@ public class SiteServiceImpl implements SiteService, SiteModel
// Throw an exception since we have a duplicate site name // Throw an exception since we have a duplicate site name
throw new SiteServiceException(MSG_UNABLE_TO_CREATE, new Object[]{shortName}); throw new SiteServiceException(MSG_UNABLE_TO_CREATE, new Object[]{shortName});
} }
return null;
}
}, AuthenticationUtil.getSystemUserName());
// Get the site parent node reference // Get the site parent node reference
NodeRef siteParent = getSiteParent(shortName); NodeRef siteParent = getSiteParent(shortName);
@@ -375,7 +368,6 @@ public class SiteServiceImpl implements SiteService, SiteModel
shareZones.add(AuthorityService.ZONE_APP_SHARE); shareZones.add(AuthorityService.ZONE_APP_SHARE);
shareZones.add(AuthorityService.ZONE_AUTH_ALFRESCO); shareZones.add(AuthorityService.ZONE_AUTH_ALFRESCO);
// Create the site's groups // Create the site's groups
String siteGroup = authorityService String siteGroup = authorityService
.createAuthority(AuthorityType.GROUP, getSiteGroup(shortName, false), shortName, shareZones); .createAuthority(AuthorityType.GROUP, getSiteGroup(shortName, false), shortName, shareZones);
@@ -513,7 +505,7 @@ public class SiteServiceImpl implements SiteService, SiteModel
} }
/** /**
* Gets a sites parent folder based on it's short name ] * Gets a sites parent folder based on it's short name
* *
* @param shortName site short name * @param shortName site short name
* @return NodeRef the site's parent * @return NodeRef the site's parent
@@ -738,6 +730,10 @@ public class SiteServiceImpl implements SiteService, SiteModel
* @return SiteInfo site information object * @return SiteInfo site information object
*/ */
private SiteInfo createSiteInfo(NodeRef siteNodeRef) private SiteInfo createSiteInfo(NodeRef siteNodeRef)
{
SiteInfo siteInfo = null;
if (this.permissionService.hasPermission(siteNodeRef, PermissionService.READ_PROPERTIES).equals(AccessStatus.ALLOWED))
{ {
// Get the properties // Get the properties
Map<QName, Serializable> properties = this.nodeService.getProperties(siteNodeRef); Map<QName, Serializable> properties = this.nodeService.getProperties(siteNodeRef);
@@ -751,7 +747,9 @@ public class SiteServiceImpl implements SiteService, SiteModel
// Create and return the site information // Create and return the site information
Map<QName, Serializable> customProperties = getSiteCustomProperties(properties); Map<QName, Serializable> customProperties = getSiteCustomProperties(properties);
SiteInfo siteInfo = new SiteInfoImpl(sitePreset, shortName, title, description, visibility, customProperties, siteNodeRef); siteInfo = new SiteInfoImpl(sitePreset, shortName, title, description, visibility, customProperties, siteNodeRef);
}
return siteInfo; return siteInfo;
} }
@@ -843,7 +841,7 @@ public class SiteServiceImpl implements SiteService, SiteModel
* *
* @return NodeRef node reference * @return NodeRef node reference
*/ */
private NodeRef getSiteNodeRef(String shortName) private NodeRef getSiteNodeRef(final String shortName)
{ {
final String cacheKey = this.tenantAdminService.getCurrentUserDomain() + '_' + shortName; final String cacheKey = this.tenantAdminService.getCurrentUserDomain() + '_' + shortName;
NodeRef siteNodeRef = this.siteNodeRefs.get(cacheKey); NodeRef siteNodeRef = this.siteNodeRefs.get(cacheKey);
@@ -859,16 +857,23 @@ public class SiteServiceImpl implements SiteService, SiteModel
else else
{ {
// not in cache - find and store // not in cache - find and store
NodeRef siteRoot = getSiteParent(shortName); final NodeRef siteRoot = getSiteParent(shortName);
siteNodeRef = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<NodeRef>()
{
public NodeRef doWork() throws Exception
{
// the site "short name" directly maps to the cm:name property // the site "short name" directly maps to the cm:name property
siteNodeRef = this.nodeService.getChildByName(siteRoot, ContentModel.ASSOC_CONTAINS, shortName); NodeRef siteNodeRef = nodeService.getChildByName(siteRoot, ContentModel.ASSOC_CONTAINS, shortName);
// cache the result if found - null results will be requeried to ensure new sites are found later // cache the result if found - null results will be required to ensure new sites are found later
if (siteNodeRef != null) if (siteNodeRef != null)
{ {
this.siteNodeRefs.put(cacheKey, siteNodeRef); siteNodeRefs.put(cacheKey, siteNodeRef);
} }
return siteNodeRef;
}
}, AuthenticationUtil.getSystemUserName());
} }
return siteNodeRef; return siteNodeRef;
} }