From 60866f22b1dff97addd9b4079aad1bf360a68492 Mon Sep 17 00:00:00 2001 From: Gary Spencer Date: Thu, 12 Jul 2007 11:08:28 +0000 Subject: [PATCH] Fixed problem where a newly created file could get read-only access rights fi the open file request specified read access attributes. This caused a problem with Excel saving files. AWC-1200. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6224 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../smb/server/repo/ContentDiskDriver.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/source/java/org/alfresco/filesys/smb/server/repo/ContentDiskDriver.java b/source/java/org/alfresco/filesys/smb/server/repo/ContentDiskDriver.java index e8650f2cac..9242f4d538 100644 --- a/source/java/org/alfresco/filesys/smb/server/repo/ContentDiskDriver.java +++ b/source/java/org/alfresco/filesys/smb/server/repo/ContentDiskDriver.java @@ -99,7 +99,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa private static final String KEY_STORE = "store"; private static final String KEY_ROOT_PATH = "rootPath"; private static final String KEY_RELATIVE_PATH = "relativePath"; - + // Token name to substitute current servers DNS name or TCP/IP address into the webapp URL private static final String TokenLocalName = "${localname}"; @@ -273,7 +273,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa } /** - * Set the file folder server + * Set the file folder service * * @param fileService FileFolderService */ @@ -361,13 +361,15 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa } else if (nodeRefs.size() == 0) { - // nothing found + // Nothing found + throw new DeviceContextException("No root found for device: \n" + " root path: " + rootPath); } else { - // we found a node + // We found a node + rootNodeRef = nodeRefs.get(0); } @@ -1416,12 +1418,16 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa // Create the network file - NetworkFile netFile = ContentNetworkFile.createFile(nodeService, contentService, mimetypeService, cifsHelper, nodeRef, params); + ContentNetworkFile netFile = ContentNetworkFile.createFile(nodeService, contentService, mimetypeService, cifsHelper, nodeRef, params); + + // Always allow write access to a newly created file + + netFile.setGrantedAccess(NetworkFile.READWRITE); // Truncate the file so that the content stream is created netFile.truncateFile( 0L); - + // Generate a file id for the file if ( netFile != null)