final String innerFolderTemplate = folderTemplate;
final String innerUserName = userName;
final PageManager innerPageManager = pageManager;
final String innerUser = userName;
User powerUser = userManager.getUser(this.adminUser);
JetspeedException pe = (JetspeedException) Subject.doAsPrivileged(powerUser.getSubject(), new PrivilegedAction()
{
public Object run()
{
try
{
// create user's home folder
// deep copy from the default folder template tree, creating a deep-copy of the template
// in the new user's folder tree
Folder source = innerPageManager.getFolder(innerFolderTemplate);
innerPageManager.deepCopyFolder(source, Folder.USER_FOLDER + innerUserName, innerUser);
return null;
}
catch (FolderNotFoundException e1) {
return e1;
} catch (InvalidFolderException e1){
return e1;
} catch (NodeException e1){
return e1;
} catch (PageNotUpdatedException e1) {
return e1;
} catch (JetspeedException e1) {
return e1;
}
}
}, null);
if(pe != null)
{
// rollback user creation and cascade roles, groups, etc
try
{
if (userManager.getUser(userName) != null)
{
userManager.removeUser(userName);
}
}
catch (Exception e)
{
log.error("Registration Error: Failed to rollback user " + userName);
}
log.error("Registration Error: Failed to create user folders for " + userName + ", " + pe.toString());
throw pe;
}
}
catch (Exception e)