mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.1 to HEAD
6349: Build fix after ReadPermissions was added to the permission model 6350: CIFS file rename fixes 6352: Management of avmsubmittedaspect, particularly as applies to newly created directories 6353: Added assemble to ignore property pattern 6354: Deployment project build stuff 6355: Fix for AR-1245 (Do not authenticate in a read only TX as it could create a person object) 6356: Office 2003 Add-Ins - Fixes to installers to support Vista 6357: Office Add-In web scripts - Updated to support the new Office 2007 extensions (.docx, .xlsx, .pptx) 6358: Fix for AR-1392 - Audit string lengths 6359: Remove unwanted rule model from repo Fix issue with update rules on spaces causing documents to be deleted in CIFS 6360: Office 2003 Add-In Installers, Vista fixes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6723 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -394,7 +394,7 @@ public class AlfrescoAuthenticator extends CifsAuthenticator
|
||||
{
|
||||
// Start a transaction
|
||||
|
||||
sess.beginReadTransaction( m_transactionService);
|
||||
sess.beginWriteTransaction( m_transactionService);
|
||||
|
||||
// Default logon status to disallow
|
||||
|
||||
|
@@ -553,10 +553,15 @@ public class CifsHelper
|
||||
|
||||
try
|
||||
{
|
||||
// remove the tempory aspects from the nodes, this will be reapplied if the new name dictates it
|
||||
nodeService.removeAspect(tempNodeRef, ContentModel.ASPECT_TEMPORARY);
|
||||
|
||||
// rename temp file to the new name
|
||||
fileFolderService.rename(tempNodeRef, newName);
|
||||
|
||||
// rename new file to old name
|
||||
fileFolderService.rename(nodeToMoveRef, tempName);
|
||||
this.nodeService.addAspect(nodeToMoveRef, ContentModel.ASPECT_TEMPORARY, null);
|
||||
}
|
||||
catch (org.alfresco.service.cmr.model.FileNotFoundException e)
|
||||
{
|
||||
@@ -617,6 +622,36 @@ public class CifsHelper
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a node
|
||||
*
|
||||
* @param nodeToRenameRef Node to be renamed
|
||||
* @param newName New name for the node
|
||||
* @throws FileExistsException
|
||||
*/
|
||||
public void rename(NodeRef nodeToRenameRef, String newName) throws FileExistsException
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check if the new file name is a temporary file name
|
||||
if ( newName.endsWith(".tmp") || newName.endsWith(".temp"))
|
||||
nodeService.addAspect(nodeToRenameRef, ContentModel.ASPECT_TEMPORARY, null);
|
||||
|
||||
fileFolderService.rename(nodeToRenameRef, newName);
|
||||
}
|
||||
catch (org.alfresco.service.cmr.model.FileExistsException e)
|
||||
{
|
||||
throw new FileExistsException(newName);
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Rename failed: \n" +
|
||||
" node to rename: " + nodeToRenameRef + "\n" +
|
||||
" new name: " + newName,
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the file name for a node
|
||||
*
|
||||
|
@@ -1213,9 +1213,9 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
|
||||
// Check for delete access
|
||||
|
||||
if ( params.hasAccessMode(AccessMode.NTDelete) &&
|
||||
permissionService.hasPermission(nodeRef, PermissionService.DELETE) == AccessStatus.DENIED)
|
||||
throw new AccessDeniedException("No delete access to " + params.getFullPath());
|
||||
// if ( params.hasAccessMode(AccessMode.NTDelete) &&
|
||||
// permissionService.hasPermission(nodeRef, PermissionService.DELETE) == AccessStatus.DENIED)
|
||||
// throw new AccessDeniedException("No delete access to " + params.getFullPath());
|
||||
|
||||
// Check if the file has a lock
|
||||
|
||||
@@ -1899,6 +1899,14 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
NodeRef targetFolderRef = getNodeForPath(tree, splitPaths[0]);
|
||||
String name = splitPaths[1];
|
||||
|
||||
// Check if this is a rename within the same folder
|
||||
|
||||
String[] oldPaths = FileName.splitPath( oldName);
|
||||
|
||||
boolean sameFolder = false;
|
||||
if ( splitPaths[0].equalsIgnoreCase( oldPaths[0]))
|
||||
sameFolder = true;
|
||||
|
||||
// Update the state table
|
||||
|
||||
boolean relinked = false;
|
||||
@@ -1961,9 +1969,30 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
|
||||
if (!relinked)
|
||||
{
|
||||
// Move the file/folder
|
||||
// Move or rename the file/folder
|
||||
|
||||
cifsHelper.move(nodeToMoveRef, targetFolderRef, name);
|
||||
if ( sameFolder == true)
|
||||
{
|
||||
// Rename the file/folder
|
||||
|
||||
cifsHelper.rename(nodeToMoveRef, name);
|
||||
|
||||
// DEBUG
|
||||
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("Renamed file: from: " + oldName + " to: " + newName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Move the file/folder
|
||||
|
||||
cifsHelper.move(nodeToMoveRef, targetFolderRef, name);
|
||||
|
||||
// DEBUG
|
||||
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("Moved file: from: " + oldName + " to: " + newName);
|
||||
}
|
||||
|
||||
// Check if we renamed a file, if so then cache the rename details for a short period
|
||||
// in case another file renamed to the old name. MS Word uses renames to move a new
|
||||
@@ -2009,7 +2038,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
// DEBUG
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Moved node: " + " from: " + oldName + " to: " + newName);
|
||||
logger.debug("Moved node: from: " + oldName + " to: " + newName);
|
||||
}
|
||||
catch (org.alfresco.repo.security.permissions.AccessDeniedException ex)
|
||||
{
|
||||
@@ -2042,7 +2071,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
|
||||
|
||||
// Convert to a general I/O exception
|
||||
|
||||
throw new IOException("Rename file " + oldName);
|
||||
throw new AccessDeniedException("Rename file " + oldName);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user