// This next chunk of code is the fancy way to force the creation of the user
// template pages to be created with subject equal to the new user
// otherwise it would be created as guest, and guest does not have enough privs.
final String innerFolderTemplate = folderTemplate;
final String innerUserFolderPath = userFolderPath;
final PageManager innerPageManager = pageManager;
final String innerUserName = userName;
final User innerUser = user;
User powerUser = userManager.getUser(this.adminUser);
JetspeedException pe = (JetspeedException) JSSubject.doAsPrivileged(userManager.getSubject(powerUser), new PrivilegedAction()
{
public Object run()
{
try
{
if (innerUserFolderPath != null)
{
innerUser.getSecurityAttributes().getAttribute(User.JETSPEED_USER_SUBSITE_ATTRIBUTE, true).setStringValue(innerUserFolderPath);
userManager.updateUser(innerUser);
}
// 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, innerUserFolderPath, innerUserName);
Folder newFolder = pageManager.getFolder(innerUserFolderPath);
newFolder.setTitle("My Home Space");
newFolder.setShortTitle("My Space");
return null;
}