Merged V3.0 to HEAD

12734: Fix for ETHREEOH-1007
   12735: Fix for ALFCOM-2326 (applied to 3.0E original code location)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12739 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2009-01-14 14:05:43 +00:00
parent fb27a3ec1a
commit b7ef06d97c

View File

@@ -792,31 +792,24 @@ public class SiteServiceImpl implements SiteService, SiteModel
// If ...
// -- the current user has change permissions rights on the site
// or
// -- the site is public and
// -- the user is ourselves and
// -- the users current role is consumer
if ((permissionService.hasPermission(siteNodeRef,
PermissionService.CHANGE_PERMISSIONS) == AccessStatus.ALLOWED)
|| (isPublic == true
&& currentUserName.equals(userName) == true && role
.equals(SiteModel.SITE_CONSUMER) == true))
// -- the user is ourselves
if ((currentUserName.equals(userName) == true) ||
(permissionService.hasPermission(siteNodeRef, PermissionService.CHANGE_PERMISSIONS) == AccessStatus.ALLOWED))
{
// Run as system user
AuthenticationUtil.runAs(
new AuthenticationUtil.RunAsWork<Object>()
new AuthenticationUtil.RunAsWork<Object>()
{
public Object doWork() throws Exception
{
public Object doWork() throws Exception
{
// Remove the user from the current permission
// group
String currentGroup = getSiteRoleGroup(
shortName, role, true);
authorityService.removeAuthority(currentGroup,
userName);
return null;
}
}, AuthenticationUtil.SYSTEM_USER_NAME);
// Remove the user from the current permission
// group
String currentGroup = getSiteRoleGroup(shortName, role, true);
authorityService.removeAuthority(currentGroup, userName);
return null;
}
}, AuthenticationUtil.SYSTEM_USER_NAME);
// Raise events
if (AuthorityType.getAuthorityType(userName) == AuthorityType.USER)
@@ -824,14 +817,15 @@ public class SiteServiceImpl implements SiteService, SiteModel
activityService.postActivity(
ActivityType.SITE_USER_REMOVED, shortName,
ACTIVITY_TOOL, getActivityData(userName, ""));
} else
}
else
{
// TODO - update this, if sites support groups
logger
.error("setMembership - failed to post activity: unexpected authority type: "
+ AuthorityType.getAuthorityType(userName));
logger.error("setMembership - failed to post activity: unexpected authority type: "
+ AuthorityType.getAuthorityType(userName));
}
} else
}
else
{
// Throw a permission exception
throw new AlfrescoRuntimeException(