diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml index 6588b55c89..e0eaf70946 100644 --- a/config/alfresco/web-client-config.xml +++ b/config/alfresco/web-client-config.xml @@ -50,6 +50,10 @@ 500 + + /app:company_home/app:user_homes + + diff --git a/source/java/org/alfresco/web/bean/wizard/NewUserWizard.java b/source/java/org/alfresco/web/bean/wizard/NewUserWizard.java index f425b42ad6..5fb021eec2 100644 --- a/source/java/org/alfresco/web/bean/wizard/NewUserWizard.java +++ b/source/java/org/alfresco/web/bean/wizard/NewUserWizard.java @@ -102,6 +102,9 @@ public class NewUserWizard extends AbstractWizardBean /** ref to the company home space folder */ private NodeRef companyHomeSpaceRef = null; + + /** ref to the default home location */ + private NodeRef defaultHomeSpaceRef; /** @@ -160,7 +163,7 @@ public class NewUserWizard extends AbstractWizardBean this.email = ""; this.companyId = ""; this.homeSpaceName = ""; - this.homeSpaceLocation = getCompanyHomeSpace(); + this.homeSpaceLocation = getDefaultHomeSpace(); } /** @@ -394,7 +397,8 @@ public class NewUserWizard extends AbstractWizardBean { if (currentHomeSpaceLocation.equals(this.homeSpaceLocation) == false && oldHomeFolderRef.equals(this.homeSpaceLocation) == false && - currentHomeSpaceLocation.equals(getCompanyHomeSpace()) == false) + currentHomeSpaceLocation.equals(getCompanyHomeSpace()) == false && + currentHomeSpaceLocation.equals(getDefaultHomeSpace()) == false) { moveHomeSpace = true; } @@ -845,6 +849,29 @@ public class NewUserWizard extends AbstractWizardBean return this.companyHomeSpaceRef; } + private NodeRef getDefaultHomeSpace() + { + if (this.defaultHomeSpaceRef == null) + { + String defaultHomeSpacePath = Application.getClientConfig(FacesContext.getCurrentInstance()).getDefaultHomeSpacePath(); + + NodeRef rootNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); + List nodes = this.searchService.selectNodes(rootNodeRef, defaultHomeSpacePath, null, this.namespaceService, + false); + + if (nodes.size() == 0) + { + throw new IllegalStateException("Unable to find company home space path: " + defaultHomeSpacePath); + } + + this.defaultHomeSpaceRef = nodes.get(0); + } + + return this.defaultHomeSpaceRef; + } + + + /** * Create the specified home space if it does not exist, and return the ID * diff --git a/source/java/org/alfresco/web/config/ClientConfigElement.java b/source/java/org/alfresco/web/config/ClientConfigElement.java index 71e1b7e841..40dc3e323b 100644 --- a/source/java/org/alfresco/web/config/ClientConfigElement.java +++ b/source/java/org/alfresco/web/config/ClientConfigElement.java @@ -58,6 +58,7 @@ public class ClientConfigElement extends ConfigElementAdapter private String initialLocation = "myalfresco"; private ExpiringValueCache wcmDomain = new ExpiringValueCache(1000*10L); private ExpiringValueCache wcmPort = new ExpiringValueCache(1000*10L); + private String defaultHomeSpacePath = "/app:company_home"; /** * Default Constructor @@ -378,7 +379,7 @@ public class ClientConfigElement extends ConfigElementAdapter { return this.homeSpacePermission; } - + /** * @param homeSpacePermission The default Home Space permission to set. */ @@ -386,6 +387,22 @@ public class ClientConfigElement extends ConfigElementAdapter { this.homeSpacePermission = homeSpacePermission; } + + /** + * @return Returns the default Home Space path. + */ + public String getDefaultHomeSpacePath() + { + return this.defaultHomeSpacePath; + } + + /** + * @param defaultHomeSpacePath The default Home Space path to set. + */ + /*package*/ void setDefaultHomeSpacePath(String defaultHomeSpacePath) + { + this.defaultHomeSpacePath = defaultHomeSpacePath; + } /** * @return Returns whether AJAX support is enabled in the client diff --git a/source/java/org/alfresco/web/config/ClientElementReader.java b/source/java/org/alfresco/web/config/ClientElementReader.java index a66da1050c..b4a642582b 100644 --- a/source/java/org/alfresco/web/config/ClientElementReader.java +++ b/source/java/org/alfresco/web/config/ClientElementReader.java @@ -42,6 +42,7 @@ public class ClientElementReader implements ConfigElementReader public static final String ELEMENT_SHELFVISIBLE = "shelf-visible"; public static final String ELEMENT_AJAX_ENABLED = "ajax-enabled"; public static final String ELEMENT_INITIALLOCATION = "initial-location"; + public static final String ELEMENT_DEFAULTHOMESPACEPATH = "default-home-space-path"; /** * @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element) @@ -161,6 +162,13 @@ public class ClientElementReader implements ConfigElementReader { configElement.setInitialLocation(initialLocation.getTextTrim()); } + + // get the default home space path + Element defaultHomeSpacePath = element.element(ELEMENT_DEFAULTHOMESPACEPATH); + if (defaultHomeSpacePath != null) + { + configElement.setDefaultHomeSpacePath(defaultHomeSpacePath.getTextTrim()); + } } return configElement;