本文整理汇总了Java中org.alfresco.jlan.server.SrvSession.addDynamicShare方法的典型用法代码示例。如果您正苦于以下问题:Java SrvSession.addDynamicShare方法的具体用法?Java SrvSession.addDynamicShare怎么用?Java SrvSession.addDynamicShare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.jlan.server.SrvSession
的用法示例。
在下文中一共展示了SrvSession.addDynamicShare方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getShareList
import org.alfresco.jlan.server.SrvSession; //导入方法依赖的package包/类
/**
* Return the list of available shares.
*
* @param host String
* @param sess SrvSession
* @param allShares boolean
* @return SharedDeviceList
*/
public SharedDeviceList getShareList(String host, SrvSession sess, boolean allShares)
{
// Check if the user has a home folder, and the session does not currently have any
// dynamic shares defined
if ( sess != null &&
sess.hasClientInformation() &&
sess.hasDynamicShares() == false &&
sess.getClientInformation() instanceof AlfrescoClientInfo)
{
AlfrescoClientInfo client = (AlfrescoClientInfo) sess.getClientInformation();
NodeRef personNode = getPersonService().getPerson(client.getUserName());
if(personNode != null)
{
NodeRef homeSpaceRef = (NodeRef)getNodeService().getProperty(personNode, ContentModel.PROP_HOMEFOLDER);
if (homeSpaceRef != null)
{
// Create the home folder share
DiskSharedDevice homeShare = createHomeDiskShare(homeSpaceRef, client.getUserName());
sess.addDynamicShare(homeShare);
if ( logger.isDebugEnabled())
{
logger.debug("Added " + getHomeFolderName() + " share to list of shares for " + client.getUserName());
}
}
}
}
// Make a copy of the global share list and add the per session dynamic shares
SharedDeviceList shrList = new SharedDeviceList(getFilesystemsConfigSection().getShares());
if ( sess != null && sess.hasDynamicShares()) {
// Add the per session dynamic shares
shrList.addShares(sess.getDynamicShareList());
}
// Remove unavailable shares from the list and return the list
if ( allShares == false)
{
shrList.removeUnavailableShares();
}
return shrList;
}
示例2: doGuestLogon
import org.alfresco.jlan.server.SrvSession; //导入方法依赖的package包/类
/**
* Logon using the guest user account.
*
* @param client
* ClientInfo
* @param sess
* SrvSession
*/
protected void doGuestLogon( ClientInfo client, SrvSession sess)
{
// Check that the client is an Alfresco client
if ( client instanceof AlfrescoClientInfo == false)
return;
AlfrescoClientInfo alfClient = (AlfrescoClientInfo) client;
// Get a guest authentication token
getAuthenticationService().authenticateAsGuest();
String ticket = getAuthenticationService().getCurrentTicket();
alfClient.setAuthenticationTicket(ticket);
// Set the home folder for the guest user
client.setUserName( getGuestUserName());
getHomeFolderForUser( client);
// Mark the client as being a guest logon
client.setGuest( true);
// Create a dynamic share for the guest user, create the disk driver and context
DiskDeviceContext diskCtx = new ContentContext(client.getUserName(), "", "", alfClient.getHomeFolder());
// Default the filesystem to look like an 80Gb sized disk with 90% free space
diskCtx.setDiskInformation(new SrvDiskInfo(2560, 64, 512, 2304));
// Create a temporary shared device for the users home directory
sess.addDynamicShare( new DiskSharedDevice( client.getUserName(), this.diskInterface, diskCtx, SharedDevice.Temporary));
}