enabled renaming of SharedFodler
This commit is contained in:
parent
2012500de8
commit
7019740af7
|
@ -876,18 +876,18 @@ public class ItemsManager extends Impersonable{
|
|||
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
|
||||
|
||||
authChecker.checkMoveOpsForProtectedFolders(ses, id);
|
||||
authChecker.checkWriteAuthorizationControl(ses, currentUser, id, false);
|
||||
|
||||
final Node nodeToMove = ses.getNodeByIdentifier(id);
|
||||
|
||||
final Item item = node2Item.getItem(nodeToMove, null);
|
||||
|
||||
if (item instanceof SharedFolder)
|
||||
throw new InvalidItemException("shared folder");
|
||||
/*if (item instanceof SharedFolder)
|
||||
throw new InvalidItemException("shared folder");*/
|
||||
|
||||
if (Constants.FOLDERS_TO_EXLUDE.contains(item.getTitle()))
|
||||
throw new InvalidItemException("protected folder cannot be renamed");
|
||||
|
||||
String uniqueName = Utils.checkExistanceAndGetUniqueName(ses, nodeToMove.getParent(), newName);
|
||||
|
||||
try {
|
||||
ses.getWorkspace().getLockManager().lock(nodeToMove.getPath(), true, true, 0,currentUser);
|
||||
|
@ -895,17 +895,23 @@ public class ItemsManager extends Impersonable{
|
|||
}catch (LockException e) {
|
||||
throw new ItemLockedException(e);
|
||||
}
|
||||
|
||||
try {
|
||||
String uniqueName = Utils.checkExistanceAndGetUniqueName(ses, nodeToMove.getParent(), newName);
|
||||
if (item instanceof SharedFolder) {
|
||||
authChecker.checkAdministratorControl(ses, currentUser, (SharedFolder)item);
|
||||
nodeToMove.setProperty(NodeProperty.TITLE.toString(), uniqueName);
|
||||
Utils.setPropertyOnChangeNode(nodeToMove, currentUser, ItemAction.RENAMED);
|
||||
accountingHandler.createRename(item.getTitle(), uniqueName, nodeToMove, currentUser, ses, false);
|
||||
} else {
|
||||
authChecker.checkWriteAuthorizationControl(ses, currentUser, id, false);
|
||||
String newPath = String.format("%s/%s", nodeToMove.getParent().getPath(), uniqueName);
|
||||
nodeToMove.setProperty(NodeProperty.TITLE.toString(), uniqueName);
|
||||
Utils.setPropertyOnChangeNode(nodeToMove, currentUser, ItemAction.RENAMED);
|
||||
accountingHandler.createRename(item.getTitle(), uniqueName, ses.getNode(newPath), currentUser, ses, false);
|
||||
ses.move(nodeToMove.getPath(), newPath);
|
||||
}
|
||||
|
||||
String newPath = String.format("%s/%s", nodeToMove.getParent().getPath(), uniqueName);
|
||||
nodeToMove.setProperty(NodeProperty.TITLE.toString(), uniqueName);
|
||||
Utils.setPropertyOnChangeNode(nodeToMove, currentUser, ItemAction.RENAMED);
|
||||
ses.move(nodeToMove.getPath(), newPath);
|
||||
|
||||
accountingHandler.createRename(item.getTitle(), uniqueName, ses.getNode(newPath), currentUser, ses, false);
|
||||
ses.save();
|
||||
|
||||
}finally {
|
||||
ses.getWorkspace().getLockManager().unlock(nodeToMove.getPath());
|
||||
ses.getWorkspace().getLockManager().unlock(nodeToMove.getParent().getPath());
|
||||
|
|
Loading…
Reference in New Issue