Merged V2.2 to HEAD

8405: Added causal exception to the runtime generated
   8408: AR-2136, AR-2137, AR-2138
   8410: WCM-1110, WCM-1111
   8417: Stopped chiba:match() function from being inserted into bindings for xforms model elements of type xs:integer.
   8419: Fixes for correct use of .empty in name spaces of QNames
   8420: Finally fixes WCM-1108 and WCM-1109
   8489: Merged V2.1 to V2.2
      8482: Fix For AR-2163
   8507: Merged V2.1 to V2.2
      8504: Fix for AR-2165 - respect repo read only setting during authentication


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8508 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-03-11 13:19:00 +00:00
parent fcf5487c5a
commit 399fe7ac67
18 changed files with 450 additions and 69 deletions

View File

@@ -102,6 +102,21 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
return transactionService;
}
public Boolean getAllowGuestLogin()
{
return allowGuestLogin;
}
public NodeService getNodeService()
{
return nodeService;
}
public PersonService getPersonService()
{
return personService;
}
public void authenticate(String userName, char[] password) throws AuthenticationException
{
// Support guest login from the login screen
@@ -136,33 +151,13 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
}
else
{
return transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Authentication>()
SetCurrentUserCallback callback = new SetCurrentUserCallback(userName);
Authentication auth = transactionService.getRetryingTransactionHelper().doInTransaction(callback, transactionService.isReadOnly(), false);
if ((auth == null) || (callback.ae != null))
{
public Authentication execute() throws Throwable
{
if (personService.personExists(userName))
{
NodeRef userNode = personService.getPerson(userName);
if (userNode != null)
{
// Get the person name and use that as the current user to line up with permission checks
String personName = (String) nodeService.getProperty(userNode, ContentModel.PROP_USERNAME);
return setCurrentUserImpl(personName);
}
else
{
// Set using the user name
return setCurrentUserImpl(userName);
}
}
else
{
// Set using the user name
return setCurrentUserImpl(userName);
}
}
}, false, false);
throw callback.ae;
}
return auth;
}
}
@@ -400,4 +395,48 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
return NTLMMode.NONE;
}
class SetCurrentUserCallback implements RetryingTransactionHelper.RetryingTransactionCallback<Authentication>
{
AuthenticationException ae = null;
String userName;
SetCurrentUserCallback(String userName)
{
this.userName = userName;
}
public Authentication execute() throws Throwable
{
try
{
if (personService.personExists(userName))
{
NodeRef userNode = personService.getPerson(userName);
if (userNode != null)
{
// Get the person name and use that as the current user to line up with permission checks
String personName = (String) nodeService.getProperty(userNode, ContentModel.PROP_USERNAME);
return setCurrentUserImpl(personName);
}
else
{
// Set using the user name
return setCurrentUserImpl(userName);
}
}
else
{
// Set using the user name
return setCurrentUserImpl(userName);
}
}
catch (AuthenticationException ae)
{
this.ae = ae;
return null;
}
}
}
}