use of org.alfresco.filesys.config.acl.AccessControlListBean in project alfresco-repository by Alfresco.
the class ServerConfigurationBean method processSecurityConfig.
/**
* Process the security configuration
*/
protected void processSecurityConfig() {
// Create the security configuration section
SecurityConfigSection secConfig = new SecurityConfigSection(this);
try {
// Check if global access controls have been specified
AccessControlListBean accessControls = securityConfigBean.getGlobalAccessControl();
if (accessControls != null) {
// Parse the access control list
AccessControlList acls = accessControls.toAccessControlList(secConfig);
if (acls != null)
secConfig.setGlobalAccessControls(acls);
}
// Check if a JCE provider class has been specified
String jceProvider = securityConfigBean.getJCEProvider();
if (jceProvider != null && jceProvider.length() > 0) {
// Set the JCE provider
secConfig.setJCEProvider(jceProvider);
} else {
// Use the default Bouncy Castle JCE provider
secConfig.setJCEProvider("org.bouncycastle.jce.provider.BouncyCastleProvider");
}
// Check if a share mapper has been specified
ShareMapper shareMapper = securityConfigBean.getShareMapper();
if (shareMapper != null) {
// Associate the share mapper
secConfig.setShareMapper(shareMapper);
}
} catch (InvalidConfigurationException ex) {
throw new AlfrescoRuntimeException(ex.getMessage());
}
}
use of org.alfresco.filesys.config.acl.AccessControlListBean in project alfresco-repository by Alfresco.
the class ServerConfigurationBean method processFilesystemsConfig.
/**
* Process the filesystems configuration
*/
protected void processFilesystemsConfig() {
// Create the filesystems configuration section
FilesystemsConfigSection fsysConfig = new FilesystemsConfigSection(this);
// Access the security configuration section
SecurityConfigSection secConfig = (SecurityConfigSection) getConfigSection(SecurityConfigSection.SectionName);
if (this.filesystemContexts != null) {
for (DeviceContext filesystem : this.filesystemContexts) {
try {
// Check the filesystem type and use the appropriate driver
DiskSharedDevice filesys = null;
// Create a new filesystem driver instance and register a context for
// the new filesystem
ExtendedDiskInterface filesysDriver = getRepoDiskInterface();
ContentContext filesysContext = (ContentContext) filesystem;
// Create state cache here and inject
StandaloneFileStateCache standaloneCache = new StandaloneFileStateCache();
standaloneCache.initializeCache(new GenericConfigElement(""), this);
filesysContext.setStateCache(standaloneCache);
if (filesysContext.hasStateCache()) {
// Register the state cache with the reaper thread
// has many side effects including initialisation of the cache
fsysConfig.addFileStateCache(filesystem.getDeviceName(), filesysContext.getStateCache());
// Create the lock manager for the context.
FileStateLockManager lockMgr = new FileStateLockManager(filesysContext.getStateCache());
filesysContext.setLockManager(lockMgr);
filesysContext.setOpLockManager(lockMgr);
}
if (!ftpConfigBean.getServerEnabled() && isContentDiskDriver2(filesysDriver)) {
((ContentContext) filesystem).setDisableNodeMonitor(true);
}
filesysDriver.registerContext(filesystem);
// Check if an access control list has been specified
AccessControlList acls = null;
AccessControlListBean accessControls = filesysContext.getAccessControlList();
if (accessControls != null) {
// Parse the access control list
acls = accessControls.toAccessControlList(secConfig);
} else if (secConfig.hasGlobalAccessControls()) {
// Use the global access control list for this disk share
acls = secConfig.getGlobalAccessControls();
}
// Create the shared filesystem
filesys = new DiskSharedDevice(filesystem.getDeviceName(), filesysDriver, filesysContext);
filesys.setConfiguration(this);
// Add any access controls to the share
filesys.setAccessControlList(acls);
if (filesysContext.getDisableChangeNotifications() == false)
filesysContext.enableChangeHandler(true);
// Start the filesystem
filesysContext.startFilesystem(filesys);
// Add the new filesystem
fsysConfig.addShare(filesys);
} catch (DeviceContextException ex) {
throw new AlfrescoRuntimeException("Error creating filesystem " + filesystem.getDeviceName(), ex);
} catch (InvalidConfigurationException ex) {
throw new AlfrescoRuntimeException(ex.getMessage(), ex);
}
}
} else {
// No filesystems defined
logger.warn("No filesystems defined");
}
// home folder share mapper could be declared in security config
}
Aggregations