mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged up to HEAD.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3129 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -29,6 +29,8 @@ import org.alfresco.filesys.smb.mailslot.TcpipNetBIOSHostAnnouncer;
|
||||
*/
|
||||
public class NetBIOSSessionSocketHandler extends SessionSocketHandler
|
||||
{
|
||||
// Session Thread group
|
||||
private static final ThreadGroup THREAD_GROUP_SESSION = new ThreadGroup("NETBIOS_SESSION_GROUP");
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
@@ -96,7 +98,7 @@ public class NetBIOSSessionSocketHandler extends SessionSocketHandler
|
||||
|
||||
// Start the new session in a seperate thread
|
||||
|
||||
Thread srvThread = new Thread(srvSess);
|
||||
Thread srvThread = new Thread(THREAD_GROUP_SESSION, srvSess);
|
||||
srvThread.setDaemon(true);
|
||||
srvThread.setName("Sess_N" + srvSess.getSessionId() + "_"
|
||||
+ sessSock.getInetAddress().getHostAddress());
|
||||
|
@@ -28,6 +28,8 @@ import org.alfresco.filesys.smb.TcpipSMB;
|
||||
*/
|
||||
public class TcpipSMBSessionSocketHandler extends SessionSocketHandler
|
||||
{
|
||||
// Session Thread group
|
||||
private static final ThreadGroup THREAD_GROUP_SESSION = new ThreadGroup("SMB_SESSION_GROUP");
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
@@ -95,7 +97,7 @@ public class TcpipSMBSessionSocketHandler extends SessionSocketHandler
|
||||
|
||||
// Start the new session in a seperate thread
|
||||
|
||||
Thread srvThread = new Thread(srvSess);
|
||||
Thread srvThread = new Thread(THREAD_GROUP_SESSION, srvSess);
|
||||
srvThread.setDaemon(true);
|
||||
srvThread.setName("Sess_T" + srvSess.getSessionId() + "_"
|
||||
+ sessSock.getInetAddress().getHostAddress());
|
||||
|
@@ -64,6 +64,7 @@ public class CifsHelper
|
||||
private FileFolderService fileFolderService;
|
||||
private MimetypeService mimetypeService;
|
||||
private PermissionService permissionService;
|
||||
private boolean isReadOnly;
|
||||
|
||||
// Mark locked files as offline
|
||||
|
||||
@@ -74,6 +75,7 @@ public class CifsHelper
|
||||
*/
|
||||
public CifsHelper()
|
||||
{
|
||||
isReadOnly = false;
|
||||
}
|
||||
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
@@ -101,6 +103,24 @@ public class CifsHelper
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns true if all files/folders should be treated as read-only
|
||||
*/
|
||||
public boolean isReadOnly()
|
||||
{
|
||||
return isReadOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the system allows files to be edited or not. The default is
|
||||
* to allow writes.
|
||||
* @param allowWrites true to allow writes, otherwise false for read-only mode
|
||||
*/
|
||||
public void setAllowWrites(boolean allowWrites)
|
||||
{
|
||||
this.isReadOnly = !allowWrites;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable marking of locked files as offline
|
||||
*
|
||||
@@ -216,7 +236,7 @@ public class CifsHelper
|
||||
|
||||
String lockTypeStr = (String) nodeProperties.get(ContentModel.PROP_LOCK_TYPE);
|
||||
|
||||
if ( lockTypeStr != null)
|
||||
if ( lockTypeStr != null )
|
||||
{
|
||||
// File is locked so mark it as read-only and offline
|
||||
|
||||
@@ -256,8 +276,16 @@ public class CifsHelper
|
||||
|
||||
// Read/write access
|
||||
|
||||
if ( permissionService.hasPermission(nodeRef, PermissionService.WRITE) == AccessStatus.DENIED)
|
||||
fileInfo.setFileAttributes(fileInfo.getFileAttributes() + FileAttribute.ReadOnly);
|
||||
boolean hasPermission = permissionService.hasPermission(nodeRef, PermissionService.WRITE) == AccessStatus.DENIED;
|
||||
if (isReadOnly || !hasPermission)
|
||||
{
|
||||
int attr = fileInfo.getFileAttributes();
|
||||
if (( attr & FileAttribute.ReadOnly) == 0)
|
||||
{
|
||||
attr += FileAttribute.ReadOnly;
|
||||
fileInfo.setFileAttributes(attr);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the normal file attribute if no other attributes are set
|
||||
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.filesys.server.core.DeviceContextException;
|
||||
import org.alfresco.filesys.server.filesys.AccessDeniedException;
|
||||
import org.alfresco.filesys.server.filesys.AccessMode;
|
||||
import org.alfresco.filesys.server.filesys.DiskInterface;
|
||||
import org.alfresco.filesys.server.filesys.FileAttribute;
|
||||
import org.alfresco.filesys.server.filesys.FileInfo;
|
||||
import org.alfresco.filesys.server.filesys.FileName;
|
||||
import org.alfresco.filesys.server.filesys.FileOpenParams;
|
||||
@@ -467,7 +468,14 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
|
||||
*/
|
||||
public boolean isReadOnly(SrvSession sess, DeviceContext ctx) throws IOException
|
||||
{
|
||||
return false;
|
||||
if (cifsHelper.isReadOnly())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -505,9 +513,19 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
|
||||
if ( pfile != null)
|
||||
{
|
||||
// DEBUG
|
||||
|
||||
if ( logger.isDebugEnabled())
|
||||
logger.debug("getInfo using pseudo file info for " + path);
|
||||
|
||||
FileInfo pseudoFileInfo = pfile.getFileInfo();
|
||||
if (cifsHelper.isReadOnly())
|
||||
{
|
||||
int attr = pseudoFileInfo.getFileAttributes();
|
||||
if (( attr & FileAttribute.ReadOnly) == 0)
|
||||
{
|
||||
attr += FileAttribute.ReadOnly;
|
||||
pseudoFileInfo.setFileAttributes(attr);
|
||||
}
|
||||
}
|
||||
return pfile.getFileInfo();
|
||||
}
|
||||
}
|
||||
|
@@ -53,6 +53,10 @@ public class Win32NetBIOSSessionSocketHandler extends SessionSocketHandler imple
|
||||
|
||||
// Constants
|
||||
//
|
||||
|
||||
// Session Thread group
|
||||
private static final ThreadGroup THREAD_GROUP_SESSION = new ThreadGroup("W32NETBIOS_SESSION_GROUP");
|
||||
|
||||
// Default LANA offline polling interval
|
||||
|
||||
public static final long LANAPollingInterval = 5000; // 5 seconds
|
||||
@@ -605,7 +609,7 @@ public class Win32NetBIOSSessionSocketHandler extends SessionSocketHandler imple
|
||||
|
||||
// Start the new session in a seperate thread
|
||||
|
||||
Thread srvThread = new Thread(srvSess);
|
||||
Thread srvThread = new Thread(THREAD_GROUP_SESSION, srvSess);
|
||||
srvThread.setDaemon(true);
|
||||
srvThread.setName("Sess_W" + srvSess.getSessionId() + "_LSN" + lsn);
|
||||
srvThread.start();
|
||||
@@ -750,7 +754,7 @@ public class Win32NetBIOSSessionSocketHandler extends SessionSocketHandler imple
|
||||
|
||||
// Start the new session in a seperate thread
|
||||
|
||||
Thread srvThread = new Thread(srvSess);
|
||||
Thread srvThread = new Thread(THREAD_GROUP_SESSION, srvSess);
|
||||
srvThread.setDaemon(true);
|
||||
srvThread.setName("Sess_WS" + srvSess.getSessionId());
|
||||
srvThread.start();
|
||||
|
Reference in New Issue
Block a user