mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Initial cut of IMAP support (disabled by default, to enable move imap sample files into extension folder)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14279 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
<value>classpath:alfresco/extension/web-client-config-custom.xml</value>
|
<value>classpath:alfresco/extension/web-client-config-custom.xml</value>
|
||||||
<value>jar:*!/META-INF/web-client-config-custom.xml</value>
|
<value>jar:*!/META-INF/web-client-config-custom.xml</value>
|
||||||
<value>workspace://SpacesStore/${spaces.company_home.childname}/${spaces.dictionary.childname}/app:webclient_extension/cm:web-client-config-custom.xml</value>
|
<value>workspace://SpacesStore/${spaces.company_home.childname}/${spaces.dictionary.childname}/app:webclient_extension/cm:web-client-config-custom.xml</value>
|
||||||
|
<value>workspace://SpacesStore/${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.imapConfig.childname}/cm:imap-config.xml</value>
|
||||||
</list>
|
</list>
|
||||||
</constructor-arg>
|
</constructor-arg>
|
||||||
</bean>
|
</bean>
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
<element-reader element-name="wizards" class="org.alfresco.web.config.WizardsElementReader"/>
|
<element-reader element-name="wizards" class="org.alfresco.web.config.WizardsElementReader"/>
|
||||||
<element-reader element-name="dashboards" class="org.alfresco.web.config.DashboardsElementReader"/>
|
<element-reader element-name="dashboards" class="org.alfresco.web.config.DashboardsElementReader"/>
|
||||||
<element-reader element-name="sidebar" class="org.alfresco.web.config.SidebarElementReader"/>
|
<element-reader element-name="sidebar" class="org.alfresco.web.config.SidebarElementReader"/>
|
||||||
|
<element-reader element-name="imapConfig" class="org.alfresco.repo.imap.config.ImapElementReader"/>
|
||||||
</element-readers>
|
</element-readers>
|
||||||
</plug-ins>
|
</plug-ins>
|
||||||
|
|
||||||
|
@@ -40,6 +40,8 @@ import javax.faces.validator.ValidatorException;
|
|||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ApplicationModel;
|
import org.alfresco.model.ApplicationModel;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.imap.AlfrescoImapConst;
|
||||||
|
import org.alfresco.repo.imap.ImapHelper;
|
||||||
import org.alfresco.repo.tenant.TenantService;
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -50,6 +52,7 @@ import org.alfresco.service.cmr.security.PersonService;
|
|||||||
import org.alfresco.service.cmr.usage.ContentUsageService;
|
import org.alfresco.service.cmr.usage.ContentUsageService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.util.ApplicationContextHelper;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.app.context.UIContextService;
|
import org.alfresco.web.app.context.UIContextService;
|
||||||
@@ -115,6 +118,8 @@ public class CreateUserWizard extends BaseWizardBean
|
|||||||
/** OwnableService bean reference */
|
/** OwnableService bean reference */
|
||||||
transient private OwnableService ownableService;
|
transient private OwnableService ownableService;
|
||||||
|
|
||||||
|
transient private ImapHelper imapHelper;
|
||||||
|
|
||||||
/** ContentUsageService bean reference */
|
/** ContentUsageService bean reference */
|
||||||
transient private ContentUsageService contentUsageService;
|
transient private ContentUsageService contentUsageService;
|
||||||
|
|
||||||
@@ -165,6 +170,21 @@ public class CreateUserWizard extends BaseWizardBean
|
|||||||
return personService;
|
return personService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ImapHelper getImapHelper()
|
||||||
|
{
|
||||||
|
if (imapHelper == null)
|
||||||
|
{
|
||||||
|
imapHelper = (ImapHelper) ApplicationContextHelper.getApplicationContext().getBean("imapHelper");
|
||||||
|
}
|
||||||
|
|
||||||
|
return imapHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImapHelper(ImapHelper imapHelper)
|
||||||
|
{
|
||||||
|
this.imapHelper = imapHelper;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tenantService The tenantService to set.
|
* @param tenantService The tenantService to set.
|
||||||
*/
|
*/
|
||||||
@@ -772,6 +792,29 @@ public class CreateUserWizard extends BaseWizardBean
|
|||||||
getPermissionService().setInheritParentPermissions(homeSpaceRef, false);
|
getPermissionService().setInheritParentPermissions(homeSpaceRef, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createImapHome()
|
||||||
|
{
|
||||||
|
NodeRef imapRoot = imapHelper.getImapRootNodeRef();
|
||||||
|
NodeRef imapUserHome = null;
|
||||||
|
|
||||||
|
// search IMAP user home
|
||||||
|
imapUserHome = this.getFileFolderService().searchSimple(imapRoot, userName);
|
||||||
|
if (imapUserHome == null)
|
||||||
|
{
|
||||||
|
// create IMAP user home
|
||||||
|
imapUserHome = this.getFileFolderService().create(imapRoot, userName, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
// search INBOX
|
||||||
|
NodeRef inbox = this.getFileFolderService().searchSimple(imapUserHome, AlfrescoImapConst.INBOX_NAME);
|
||||||
|
if (inbox == null)
|
||||||
|
{
|
||||||
|
// create IMAP user home
|
||||||
|
inbox = this.getFileFolderService().create(imapUserHome, AlfrescoImapConst.INBOX_NAME, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
setupHomeSpacePermissions(imapUserHome);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return default permission string to set for other users for a new Home Space
|
* @return default permission string to set for other users for a new Home Space
|
||||||
*/
|
*/
|
||||||
@@ -831,6 +874,12 @@ public class CreateUserWizard extends BaseWizardBean
|
|||||||
// default to Company Home
|
// default to Company Home
|
||||||
homeSpaceNodeRef = getCompanyHomeSpace();
|
homeSpaceNodeRef = getCompanyHomeSpace();
|
||||||
}
|
}
|
||||||
|
// Create IMAP user Home
|
||||||
|
if (imapHelper.isPatchApplied())
|
||||||
|
{
|
||||||
|
createImapHome();
|
||||||
|
}
|
||||||
|
|
||||||
props.put(ContentModel.PROP_HOMEFOLDER, homeSpaceNodeRef);
|
props.put(ContentModel.PROP_HOMEFOLDER, homeSpaceNodeRef);
|
||||||
props.put(ContentModel.PROP_EMAIL, this.email);
|
props.put(ContentModel.PROP_EMAIL, this.email);
|
||||||
props.put(ContentModel.PROP_ORGID, this.companyId);
|
props.put(ContentModel.PROP_ORGID, this.companyId);
|
||||||
|
@@ -43,6 +43,8 @@ import javax.transaction.UserTransaction;
|
|||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ApplicationModel;
|
import org.alfresco.model.ApplicationModel;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.imap.AlfrescoImapConst;
|
||||||
|
import org.alfresco.repo.imap.ImapHelper;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationException;
|
import org.alfresco.repo.security.authentication.AuthenticationException;
|
||||||
import org.alfresco.repo.tenant.TenantService;
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
@@ -54,6 +56,7 @@ import org.alfresco.service.cmr.security.PermissionService;
|
|||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.util.ApplicationContextHelper;
|
||||||
import org.alfresco.web.app.Application;
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.app.context.UIContextService;
|
import org.alfresco.web.app.context.UIContextService;
|
||||||
import org.alfresco.web.bean.repository.Node;
|
import org.alfresco.web.bean.repository.Node;
|
||||||
@@ -120,12 +123,15 @@ public class NewUserWizard extends AbstractWizardBean
|
|||||||
/** action context */
|
/** action context */
|
||||||
private Node person = null;
|
private Node person = null;
|
||||||
|
|
||||||
/** ref to the company home space folder */
|
/** ImapHelper bean reference */
|
||||||
private NodeRef companyHomeSpaceRef = null;
|
transient private ImapHelper imapHelper;
|
||||||
|
|
||||||
/** ref to the default home location */
|
/** ref to the default home location */
|
||||||
private NodeRef defaultHomeSpaceRef;
|
private NodeRef defaultHomeSpaceRef;
|
||||||
|
|
||||||
|
/** ref to the company home space folder */
|
||||||
|
private NodeRef companyHomeSpaceRef = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param authenticationService The AuthenticationService to set.
|
* @param authenticationService The AuthenticationService to set.
|
||||||
@@ -308,6 +314,21 @@ public class NewUserWizard extends AbstractWizardBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ImapHelper getImapHelper()
|
||||||
|
{
|
||||||
|
if (imapHelper == null)
|
||||||
|
{
|
||||||
|
imapHelper = (ImapHelper) ApplicationContextHelper.getApplicationContext().getBean("imapHelper");
|
||||||
|
}
|
||||||
|
|
||||||
|
return imapHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImapHelper(ImapHelper imapHelper)
|
||||||
|
{
|
||||||
|
this.imapHelper = imapHelper;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#getStepTitle()
|
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#getStepTitle()
|
||||||
*/
|
*/
|
||||||
@@ -603,6 +624,11 @@ public class NewUserWizard extends AbstractWizardBean
|
|||||||
|
|
||||||
// create the ACEGI Authentication instance for the new user
|
// create the ACEGI Authentication instance for the new user
|
||||||
this.getAuthenticationService().createAuthentication(this.userName, this.password.toCharArray());
|
this.getAuthenticationService().createAuthentication(this.userName, this.password.toCharArray());
|
||||||
|
// create IMAP home for this user
|
||||||
|
if (imapHelper.isPatchApplied())
|
||||||
|
{
|
||||||
|
createImapHome();
|
||||||
|
}
|
||||||
|
|
||||||
if (logger.isDebugEnabled()) logger.debug("Created User Authentication instance for username: " + this.userName);
|
if (logger.isDebugEnabled()) logger.debug("Created User Authentication instance for username: " + this.userName);
|
||||||
}
|
}
|
||||||
@@ -1086,6 +1112,32 @@ public class NewUserWizard extends AbstractWizardBean
|
|||||||
return config.getHomeSpacePermission();
|
return config.getHomeSpacePermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createImapHome()
|
||||||
|
{
|
||||||
|
NodeRef imapRoot = imapHelper.getImapRootNodeRef();
|
||||||
|
NodeRef imapUserHome = null;
|
||||||
|
NodeRef inbox = null;
|
||||||
|
|
||||||
|
// search IMAP user home
|
||||||
|
imapUserHome = this.getFileFolderService().searchSimple(imapRoot, userName);
|
||||||
|
if (imapUserHome == null)
|
||||||
|
{
|
||||||
|
// create IMAP user home
|
||||||
|
imapUserHome = this.getFileFolderService().create(imapRoot, userName, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
// search INBOX
|
||||||
|
inbox = this.getFileFolderService().searchSimple(imapUserHome, AlfrescoImapConst.INBOX_NAME);
|
||||||
|
if (inbox == null)
|
||||||
|
{
|
||||||
|
// create IMAP user home
|
||||||
|
inbox = this.getFileFolderService().create(imapUserHome, AlfrescoImapConst.INBOX_NAME, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
setupHomeSpacePermissions(imapUserHome);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void invalidateUserList()
|
private void invalidateUserList()
|
||||||
{
|
{
|
||||||
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
|
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
|
||||||
|
@@ -1193,6 +1193,10 @@
|
|||||||
<property-name>tenantService</property-name>
|
<property-name>tenantService</property-name>
|
||||||
<value>#{tenantService}</value>
|
<value>#{tenantService}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>imapHelper</property-name>
|
||||||
|
<value>#{imapHelper}</value>
|
||||||
|
</managed-property>
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
@@ -4960,6 +4964,10 @@
|
|||||||
<property-name>contentUsageService</property-name>
|
<property-name>contentUsageService</property-name>
|
||||||
<value>#{ContentUsageService}</value>
|
<value>#{ContentUsageService}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>imapHelper</property-name>
|
||||||
|
<value>#{imapHelper}</value>
|
||||||
|
</managed-property>
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
|
Reference in New Issue
Block a user