Community profiling - repository container WebScript auth txn improvements:

- Fix to return null when a ROLE_ authority is requested from AuthorityDAO - was making needless query to DB that always returned empty and missing caches due to null return value
 - RepositoryContainer improvements - reduce number of txns required during init from 2 to 1, optimized code path when runAs() user is the same as currently authenticated user
 - Optimized code paths through hot Dictionary/Namespace methods when MT is disabled
 - Javadoc corrections
 - small measurable difference to large scale Share test
 - notable improvement to “short” webscript tests – round trip time for a single low impact WebScript request improved

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@41585 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2012-09-14 10:07:01 +00:00
parent d15dad68f3
commit 966dfd2566
2 changed files with 12 additions and 14 deletions

View File

@@ -1026,7 +1026,7 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
}
}
private NodeRef getAuthorityOrNull(String name)
private NodeRef getAuthorityOrNull(final String name)
{
try
{
@@ -1034,13 +1034,9 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
{
return personService.getPerson(name, false);
}
else if (AuthorityType.getAuthorityType(name).equals(AuthorityType.GUEST))
else if (AuthorityType.getAuthorityType(name).equals(AuthorityType.GUEST) || AuthorityType.getAuthorityType(name).equals(AuthorityType.ADMIN))
{
return personService.getPerson(name, false);
}
else if (AuthorityType.getAuthorityType(name).equals(AuthorityType.ADMIN))
{
return personService.getPerson(name, false);
return null;
}
else
{

View File

@@ -199,7 +199,7 @@ public class AuthorityServiceImpl implements AuthorityService, InitializingBean
canonicalName = authorityName;
}
// Determine whether the administrator role is mapped to this user or one of their groups
// Determine whether the guest role is mapped to this user or one of their groups
return getAuthoritiesForUser(canonicalName).contains(PermissionService.GUEST_AUTHORITY);
}
@@ -286,18 +286,20 @@ public class AuthorityServiceImpl implements AuthorityService, InitializingBean
tenantService.getBaseNameUser(currentUserName).equalsIgnoreCase(AuthenticationUtil.getGuestUserName()))
{
isGuestUser = true;
}
// Check if any of the user's groups are listed as guest groups
if (!isAdminUser && !isGuestUser)
{
for (String authority : guestGroups)
if (guestGroups.size() != 0)
{
if (hasAuthority(currentUserName, authority) || hasAuthority(currentUserName, tenantService.getBaseNameUser(authority)))
for (String authority : guestGroups)
{
isGuestUser = true;
break;
if (hasAuthority(currentUserName, authority) || hasAuthority(currentUserName, tenantService.getBaseNameUser(authority)))
{
isGuestUser = true;
break;
}
}
}
}
@@ -310,7 +312,7 @@ public class AuthorityServiceImpl implements AuthorityService, InitializingBean
// Give all non-guest users the ALL authorities
if (!isGuestUser)
{
authorities.addAll(allSet);
authorities.addAll(allSet);
}
else
{