. Performance improvements to authenticating users per screen refresh (5% improvement for basic screens)

. Minor performance improvements to permissions in hot-spot areas (as identified from profiling)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2050 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2005-12-20 14:45:50 +00:00
parent c72f1e626f
commit af6dc02c9e
5 changed files with 38 additions and 17 deletions

View File

@@ -120,8 +120,8 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
GrantedAuthority[] gas = new GrantedAuthority[1]; GrantedAuthority[] gas = new GrantedAuthority[1];
gas[0] = new GrantedAuthorityImpl("ROLE_AUTHENTICATED"); gas[0] = new GrantedAuthorityImpl("ROLE_AUTHENTICATED");
UserDetails ud = new User(userName, password, getEnabled(userName), !getAccountHasExpired(userName), UserDetails ud = new User(userName, password, getEnabled(userRef), !getAccountHasExpired(userRef),
!getCredentialsHaveExpired(userName), !getAccountlocked(userName), gas); !getCredentialsHaveExpired(userRef), !getAccountlocked(userRef), gas);
return ud; return ud;
} }
@@ -305,7 +305,11 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
public boolean getAccountHasExpired(String userName) public boolean getAccountHasExpired(String userName)
{ {
NodeRef userNode = getUserOrNull(userName); return getAccountHasExpired(getUserOrNull(userName));
}
private boolean getAccountHasExpired(NodeRef userNode)
{
if (userNode == null) if (userNode == null)
{ {
return false; return false;
@@ -332,7 +336,11 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
public boolean getAccountlocked(String userName) public boolean getAccountlocked(String userName)
{ {
NodeRef userNode = getUserOrNull(userName); return getAccountlocked(getUserOrNull(userName));
}
private boolean getAccountlocked(NodeRef userNode)
{
if (userNode == null) if (userNode == null)
{ {
return false; return false;
@@ -347,10 +355,14 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
return DefaultTypeConverter.INSTANCE.booleanValue(ser); return DefaultTypeConverter.INSTANCE.booleanValue(ser);
} }
} }
public boolean getCredentialsExpire(String userName) public boolean getCredentialsExpire(String userName)
{ {
NodeRef userNode = getUserOrNull(userName); return getCredentialsExpired(getUserOrNull(userName));
}
private boolean getCredentialsExpired(NodeRef userNode)
{
if (userNode == null) if (userNode == null)
{ {
return false; return false;
@@ -387,7 +399,11 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
public boolean getCredentialsHaveExpired(String userName) public boolean getCredentialsHaveExpired(String userName)
{ {
NodeRef userNode = getUserOrNull(userName); return getCredentialsHaveExpired(getUserOrNull(userName));
}
private boolean getCredentialsHaveExpired(NodeRef userNode)
{
if (userNode == null) if (userNode == null)
{ {
return false; return false;
@@ -414,7 +430,11 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
public boolean getEnabled(String userName) public boolean getEnabled(String userName)
{ {
NodeRef userNode = getUserOrNull(userName); return getEnabled(getUserOrNull(userName));
}
private boolean getEnabled(NodeRef userNode)
{
if (userNode == null) if (userNode == null)
{ {
return false; return false;

View File

@@ -27,7 +27,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
* *
* @author andyh * @author andyh
*/ */
public class SimpleNodePermissionEntry extends AbstractNodePermissionEntry implements Serializable public final class SimpleNodePermissionEntry extends AbstractNodePermissionEntry implements Serializable
{ {
/** /**
* Comment for <code>serialVersionUID</code> * Comment for <code>serialVersionUID</code>

View File

@@ -25,7 +25,7 @@ import org.alfresco.service.cmr.security.AccessStatus;
* *
* @author andyh * @author andyh
*/ */
public class SimplePermissionEntry extends AbstractPermissionEntry public final class SimplePermissionEntry extends AbstractPermissionEntry
{ {
/* /*

View File

@@ -23,7 +23,7 @@ import org.alfresco.service.namespace.QName;
* *
* @author andyh * @author andyh
*/ */
public class SimplePermissionReference extends AbstractPermissionReference public final class SimplePermissionReference extends AbstractPermissionReference
{ {
/* /*
* The type * The type

View File

@@ -347,7 +347,6 @@ public class HibernatePermissionsDAO extends HibernateDaoSupport implements Perm
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void deleteAllPermissionsForAuthority(final String authority) public void deleteAllPermissionsForAuthority(final String authority)
{ {
HibernateCallback callback = new HibernateCallback() HibernateCallback callback = new HibernateCallback()
{ {
public Object doInHibernate(Session session) public Object doInHibernate(Session session)
@@ -365,8 +364,7 @@ public class HibernatePermissionsDAO extends HibernateDaoSupport implements Perm
} }
// Utility methods to create simple detached objects for the outside // Utility methods to create simple detached objects for the outside world
// // world
// We do not pass out the hibernate objects // We do not pass out the hibernate objects
private static SimpleNodePermissionEntry createSimpleNodePermissionEntry( private static SimpleNodePermissionEntry createSimpleNodePermissionEntry(
@@ -388,10 +386,13 @@ public class HibernatePermissionsDAO extends HibernateDaoSupport implements Perm
{ {
return null; return null;
} }
HashSet<SimplePermissionEntry> spes = new HashSet<SimplePermissionEntry>(); HashSet<SimplePermissionEntry> spes = new HashSet<SimplePermissionEntry>(nes.size(), 1.0f);
for (org.alfresco.repo.security.permissions.impl.hibernate.PermissionEntry pe : nes) if (nes.size() != 0)
{ {
spes.add(createSimplePermissionEntry(pe)); for (org.alfresco.repo.security.permissions.impl.hibernate.PermissionEntry pe : nes)
{
spes.add(createSimplePermissionEntry(pe));
}
} }
return spes; return spes;
} }