git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6055 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-06-21 16:07:19 +00:00
parent 24fcc32824
commit 757616bc85

View File

@@ -241,6 +241,14 @@ public abstract class AuthenticationUtil
ContextHolder.setContext(null);
}
/**
* Execute a unit of work as a given user. The thread's authenticated user will be
* returned to its normal state after the call.
*
* @param runAsWork the unit of work to do
* @param uid the user ID
* @return Returns the work's return value
*/
public static <R> R runAs(RunAsWork<R> runAsWork, String uid)
{
String currentUser = AuthenticationUtil.getCurrentUserName();