}
}
public void renameFolder(String sessionId, XStaticFolder folder, String newName) throws DbOperationFailedException,
SessionExpiredException {
FolderService folderService = ServiceProvider
.getFolderService(getLoggedInUser(sessionId));
AuthUser user = getLoggedInUser(sessionId);
boolean mayWrite = false;
for (Role r: user.getRoles()) {
if (r.hasPermission(Right.WRITE)) {
mayWrite = true;
break;
}
}
if (!mayWrite) {
for (Group g: user.getGroups()) {
for (Role r: g.getRoles()) {
if (r.hasPermission(Right.WRITE)) {
mayWrite = true;
break;
}
}
}
}
if (!mayWrite) {
throw new DbOperationFailedException("Not enough rights to rename folder '" +
folder.getName() + "'.");
}
// ExplorerTreeNode folder = folderService.getTreeNode(xFolderElement
// .getId());
ExplorerTreeNode root = null;
try {
root = FolderModel.getInstance().load(getLoggedInUser(sessionId));
} catch (PaloIOException e) {
// TODO Auto-generated catch block
}
if (root == null) {
return;
}
ExplorerTreeNode fold = find(root, folder.getId());
if (fold != null) {
folderService.setName(newName, fold);
saveRoot(sessionId, root);
}
}