diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml
index b0b15b578d..bdef462051 100644
--- a/config/alfresco/bootstrap-context.xml
+++ b/config/alfresco/bootstrap-context.xml
@@ -82,7 +82,7 @@
-
+
@@ -175,183 +175,18 @@
-
-
-
-
-
-
-
-
- /
- alfresco/bootstrap/alfrescoUserStore.xml
-
-
- /${alfresco_user_store.system_container.childname}
- alfresco/bootstrap/alfrescoAuthorityStore.xml
-
-
- /${alfresco_user_store.system_container.childname}
- alfresco/bootstrap/alfrescoAuthorityStorePermission.xml
-
-
- /${alfresco_user_store.system_container.childname}/sys:authorities
- alfresco/bootstrap/emailServer.xml
-
-
- /${alfresco_user_store.system_container.childname}/sys:authorities
- alfresco/bootstrap/adminGroup.xml
-
-
-
-
-
-
-
-
-
- /
- alfresco/bootstrap/descriptor.xml
-
-
- /
- alfresco/bootstrap/systemRegistry.xml
-
-
-
-
-
-
-
-
-
- /
- alfresco/bootstrap/lightWeightVersionStore.xml
-
-
-
-
-
-
-
-
-
- /
- alfresco/bootstrap/version2Store.xml
-
-
-
-
-
-
-
-
-
- /
- alfresco/bootstrap/spacesArchive.xml
-
-
-
-
-
-
-
-
-
-
-
-
-
- /
- alfresco/bootstrap/spaces.xml
- alfresco/messages/bootstrap-spaces
-
-
- /
- alfresco/bootstrap/system.xml
-
-
- /
- alfresco/bootstrap/categories.xml
-
-
- /
- alfresco/bootstrap/multilingualRoot.xml
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.childname}
- alfresco/templates/software_engineering_project.xml
- alfresco/messages/bootstrap-templates
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname}
- alfresco/templates/content_template_examples.xml
- alfresco/messages/bootstrap-content-template-examples
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname}
- alfresco/templates/readme_template.xml
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.email.childname}
- alfresco/templates/email_templates.acp
- alfresco/messages/bootstrap-content-template-examples
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.rss.childname}
- alfresco/templates/rss_templates.acp
- alfresco/messages/bootstrap-content-template-examples
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.scripts.childname}
- alfresco/bootstrap/example_javascripts.acp
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}
- alfresco/bootstrap/webScripts.xml
- alfresco/messages/bootstrap-webScripts
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}
- alfresco/bootstrap/webScriptsExtensions.xml
- alfresco/messages/bootstrap-webScriptsExtensions
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}
- alfresco/bootstrap/webScriptsReadme.xml
-
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}
- alfresco/bootstrap/customModelsSpace.acp
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}
- alfresco/bootstrap/customMessagesSpace.xml
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}
- alfresco/bootstrap/customWebClientExtensionSpace.xml
-
-
-
- /${spaces.company_home.childname}/${spaces.dictionary.childname}
- alfresco/bootstrap/customWorkflowDefsSpace.acp
-
-
-
- /cm:categoryRoot
- alfresco/bootstrap/tagRootCategory.xml
-
-
-
- /${spaces.company_home.childname}
- alfresco/bootstrap/sitesSpace.xml
- alfresco/messages/bootstrap-spaces
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.Dialect/AlfrescoSchemaUpdate-Person.sql b/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.Dialect/AlfrescoSchemaUpdate-Person.sql
index 15494ee959..7553e11a53 100644
--- a/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.Dialect/AlfrescoSchemaUpdate-Person.sql
+++ b/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.Dialect/AlfrescoSchemaUpdate-Person.sql
@@ -22,7 +22,7 @@ UPDATE
qname_localname =
(
SELECT
- p.string_value
+ LOWER(p.string_value)
FROM
alf_node_properties p
JOIN alf_qname q on p.qname_id = q.id
@@ -55,11 +55,11 @@ UPDATE
--
-- Record script finish
--
-DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-Person';
+DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-Person-2';
INSERT INTO alf_applied_patch
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
VALUES
(
- 'patch.db-V2.2-Person', 'Manually executed script upgrade V2.2: Person user name also in the association qname',
- 0, 90, -1, 91, null, 'UNKOWN', 1, 1, 'Script completed'
+ 'patch.db-V2.2-Person-2', 'Manually executed script upgrade V2.2: Person user name also in the association qname',
+ 0, 1007, -1, 1008, null, 'UNKOWN', 1, 1, 'Script completed'
);
diff --git a/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoSchemaUpdate-2.1-A--to--2.2-ACL.sql b/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoSchemaUpdate-2.1-A--to--2.2-ACL.sql
index 65553f9f48..8ab860eae1 100644
--- a/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoSchemaUpdate-2.1-A--to--2.2-ACL.sql
+++ b/config/alfresco/dbscripts/upgrade/2.2/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoSchemaUpdate-2.1-A--to--2.2-ACL.sql
@@ -181,7 +181,7 @@ ALTER TABLE alf_access_control_entry
--
-- Record script finish
--
-DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-ACL';
+DELETE FROM alf_applied_patch WHERE id = 'patch.db-V2.2-ACL-From-2.1-A';
INSERT INTO alf_applied_patch
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
VALUES
diff --git a/config/alfresco/extension/chaining-example.zip b/config/alfresco/extension/chaining-example.zip
new file mode 100644
index 0000000000..1bf199b78d
Binary files /dev/null and b/config/alfresco/extension/chaining-example.zip differ
diff --git a/config/alfresco/extension/ehcache-custom.xml.sample.cluster b/config/alfresco/extension/ehcache-custom.xml.sample.cluster
index 2619851903..517c46c777 100644
--- a/config/alfresco/extension/ehcache-custom.xml.sample.cluster
+++ b/config/alfresco/extension/ehcache-custom.xml.sample.cluster
@@ -10,7 +10,7 @@
properties="heartbeatInterval=5000,
peerDiscovery=automatic,
multicastGroupAddress=230.0.0.1,
- multicastGroupPort=4446"/>
+ multicastGroupPort=4446"
/>
-
-
- true
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config/alfresco/extension/ldap-authentication-context.xml.sample b/config/alfresco/extension/ldap-authentication-context.xml.sample
index d024f42463..225141e2f4 100644
--- a/config/alfresco/extension/ldap-authentication-context.xml.sample
+++ b/config/alfresco/extension/ldap-authentication-context.xml.sample
@@ -14,17 +14,14 @@
-
-
-
-
- true
-
-
- true
-
-
+
+
+
+
+
+
+
diff --git a/config/alfresco/extension/mt/mt-admin-context.xml.sample b/config/alfresco/extension/mt/mt-admin-context.xml.sample
index 4836306b9b..5d63e0f970 100644
--- a/config/alfresco/extension/mt/mt-admin-context.xml.sample
+++ b/config/alfresco/extension/mt/mt-admin-context.xml.sample
@@ -3,6 +3,17 @@
+
+
+
+
+
+
+
+
diff --git a/config/alfresco/import-export-context.xml b/config/alfresco/import-export-context.xml
index 66e4987505..1fcdf4f55b 100644
--- a/config/alfresco/import-export-context.xml
+++ b/config/alfresco/import-export-context.xml
@@ -341,5 +341,183 @@
${version.store.version2Store}
+
+
+
+
+
+
+
+
+ /
+ alfresco/bootstrap/alfrescoUserStore.xml
+
+
+ /${alfresco_user_store.system_container.childname}
+ alfresco/bootstrap/alfrescoAuthorityStore.xml
+
+
+ /${alfresco_user_store.system_container.childname}
+ alfresco/bootstrap/alfrescoAuthorityStorePermission.xml
+
+
+ /${alfresco_user_store.system_container.childname}/sys:authorities
+ alfresco/bootstrap/emailServer.xml
+
+
+ /${alfresco_user_store.system_container.childname}/sys:authorities
+ alfresco/bootstrap/adminGroup.xml
+
+
+
+
+
+
+
+
+
+ /
+ alfresco/bootstrap/descriptor.xml
+
+
+ /
+ alfresco/bootstrap/systemRegistry.xml
+
+
+
+
+
+
+
+
+
+ /
+ alfresco/bootstrap/lightWeightVersionStore.xml
+
+
+
+
+
+
+
+
+
+ /
+ alfresco/bootstrap/version2Store.xml
+
+
+
+
+
+
+
+
+
+ /
+ alfresco/bootstrap/spacesArchive.xml
+
+
+
+
+
+
+
+
+
+ /
+ alfresco/bootstrap/spaces.xml
+ alfresco/messages/bootstrap-spaces
+
+
+ /
+ alfresco/bootstrap/system.xml
+
+
+ /
+ alfresco/bootstrap/categories.xml
+
+
+ /
+ alfresco/bootstrap/multilingualRoot.xml
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.childname}
+ alfresco/templates/software_engineering_project.xml
+ alfresco/messages/bootstrap-templates
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname}
+ alfresco/templates/content_template_examples.xml
+ alfresco/messages/bootstrap-content-template-examples
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.content.childname}
+ alfresco/templates/readme_template.xml
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.email.childname}
+ alfresco/templates/email_templates.acp
+ alfresco/messages/bootstrap-content-template-examples
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.templates.rss.childname}
+ alfresco/templates/rss_templates.acp
+ alfresco/messages/bootstrap-content-template-examples
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}/${spaces.scripts.childname}
+ alfresco/bootstrap/example_javascripts.acp
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}
+ alfresco/bootstrap/webScripts.xml
+ alfresco/messages/bootstrap-webScripts
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}
+ alfresco/bootstrap/webScriptsExtensions.xml
+ alfresco/messages/bootstrap-webScriptsExtensions
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}
+ alfresco/bootstrap/webScriptsReadme.xml
+
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}
+ alfresco/bootstrap/customModelsSpace.acp
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}
+ alfresco/bootstrap/customMessagesSpace.xml
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}
+ alfresco/bootstrap/customWebClientExtensionSpace.xml
+
+
+
+ /${spaces.company_home.childname}/${spaces.dictionary.childname}
+ alfresco/bootstrap/customWorkflowDefsSpace.acp
+
+
+
+ /cm:categoryRoot
+ alfresco/bootstrap/tagRootCategory.xml
+
+
+
+ /${spaces.company_home.childname}
+ alfresco/bootstrap/sitesSpace.xml
+ alfresco/messages/bootstrap-spaces
+
+
+
+
diff --git a/config/alfresco/messages/patch-service.properties b/config/alfresco/messages/patch-service.properties
index 3d03b80c84..ff8b841cbe 100644
--- a/config/alfresco/messages/patch-service.properties
+++ b/config/alfresco/messages/patch-service.properties
@@ -182,8 +182,8 @@ patch.AVMProperties.result=Properties were moved.
patch.customModels.description=Adds 'Models' folder to Data Dictionary
patch.customMessages.description=Adds 'Messages' folder to Data Dictionary
-patch.customWebClientExtension.description=Adds 'Web Client Extension' folder to Data Dictionary
-
+patch.customWebClientExtension.description=Adds 'Web Client Extension' folder to Data Dictionary
+
patch.customWorkflowDefs.description=Adds 'Workflow Definitions' folder to Data Dictionary.
patch.emailContributorGroup.description=Adds the 'GROUP_EMAIL_CONTRIBUTORS' group.
@@ -245,3 +245,6 @@ patch.administratorGroup.description=Adds the 'ALFRESCO_ADMINISTRATORS' group.
patch.moveWCMToGroupBasedPermissionsPatch.description=Move WCM to group based permissions.
patch.moveWCMToGroupBasedPermissionsPatch.result=WCM moved to group based permissions.
+
+patch.migrateVersionStoreUpdateCounter.description=Update internal version2Store counter (if needed).
+patch.migrateVersionStoreUpdateCounter.result=Update internal version2Store counter (if needed): {0}
diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml
index 6cf0c40975..989aba0526 100644
--- a/config/alfresco/patch/patch-services-context.xml
+++ b/config/alfresco/patch/patch-services-context.xml
@@ -1531,17 +1531,6 @@
-
-
- patch.db-V2.2-Person
- patch.schemaUpgradeScript.description
- 0
- 134
- 135
-
- classpath:alfresco/dbscripts/upgrade/2.2/${db.script.dialect}/AlfrescoSchemaUpdate-Person.sql
-
-
patch.redeploySubmitProcess4
@@ -1716,4 +1705,26 @@
+
+ patch.migrateVersionStoreUpdateCounter
+ patch.migrateVersionStoreUpdateCounter.description
+ 0
+ 2004
+ 2005
+
+
+
+
+
+
+
+ patch.db-V2.2-Person-2
+ patch.schemaUpgradeScript.description
+ 0
+ 2005
+ 2006
+
+ classpath:alfresco/dbscripts/upgrade/2.2/${db.script.dialect}/AlfrescoSchemaUpdate-Person.sql
+
+
diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties
index e5dc1ccebe..5a7b486753 100644
--- a/config/alfresco/version.properties
+++ b/config/alfresco/version.properties
@@ -19,4 +19,4 @@ version.build=@build-number@
# Schema number
-version.schema=2004
+version.schema=2006
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/GenericBootstrapPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/GenericBootstrapPatch.java
index 7387d7572b..567ab98368 100644
--- a/source/java/org/alfresco/repo/admin/patch/impl/GenericBootstrapPatch.java
+++ b/source/java/org/alfresco/repo/admin/patch/impl/GenericBootstrapPatch.java
@@ -24,7 +24,7 @@
*/
package org.alfresco.repo.admin.patch.impl;
-import java.util.Collections;
+import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
@@ -118,7 +118,8 @@ public class GenericBootstrapPatch extends AbstractPatch
}
}
String path = bootstrapView.getProperty("path");
- List bootstrapViews = Collections.singletonList(bootstrapView);
+ List bootstrapViews = new ArrayList(1);
+ bootstrapViews.add(bootstrapView);
// modify the bootstrapper
importerBootstrap.setBootstrapViews(bootstrapViews);
importerBootstrap.setUseExistingStore(true); // allow import into existing store
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/MigrateVersionStoreUpdateCounterPatch.java b/source/java/org/alfresco/repo/admin/patch/impl/MigrateVersionStoreUpdateCounterPatch.java
new file mode 100644
index 0000000000..e8ff181e64
--- /dev/null
+++ b/source/java/org/alfresco/repo/admin/patch/impl/MigrateVersionStoreUpdateCounterPatch.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2005-2009 Alfresco Software Limited.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing
+ */
+package org.alfresco.repo.admin.patch.impl;
+
+import org.alfresco.i18n.I18NUtil;
+import org.alfresco.repo.admin.patch.AbstractPatch;
+import org.alfresco.repo.version.Version2Model;
+import org.alfresco.repo.version.VersionModel;
+import org.alfresco.repo.version.common.counter.VersionCounterService;
+import org.alfresco.service.cmr.repository.StoreRef;
+
+/**
+ * Update internal version2Store counter if needed (eg. affects upgrades from 2.x to 3.0.1, will not affect upgrades from 2.x to 3.1.0)
+ */
+public class MigrateVersionStoreUpdateCounterPatch extends AbstractPatch
+{
+ private static final String MSG_SUCCESS = "patch.migrateVersionStoreUpdateCounter.result";
+
+ private VersionCounterService versionCounterService;
+
+ public void setVersionCounterService(VersionCounterService versionCounterService)
+ {
+ this.versionCounterService = versionCounterService;
+ }
+
+ @Override
+ protected String applyInternal() throws Exception
+ {
+ int oldV1count = versionCounterService.currentVersionNumber(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, VersionModel.STORE_ID));
+ int oldV2count = versionCounterService.currentVersionNumber(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, Version2Model.STORE_ID));
+
+ int newV2count = (oldV1count+oldV2count);
+ versionCounterService.setVersionNumber(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, Version2Model.STORE_ID), newV2count);
+
+ // build the result message
+ String msg = I18NUtil.getMessage(MSG_SUCCESS, "oldV1count="+oldV1count+",oldV2count="+oldV2count+",newV2count="+newV2count);
+
+ // done
+ return msg;
+ }
+}
diff --git a/source/java/org/alfresco/repo/avm/AVMExpiredContentProcessor.java b/source/java/org/alfresco/repo/avm/AVMExpiredContentProcessor.java
index 6b61d5e540..625f874a95 100644
--- a/source/java/org/alfresco/repo/avm/AVMExpiredContentProcessor.java
+++ b/source/java/org/alfresco/repo/avm/AVMExpiredContentProcessor.java
@@ -200,7 +200,7 @@ public class AVMExpiredContentProcessor
};
// perform the work as the system user
- AuthenticationUtil.runAs(authorisedWork, AuthenticationUtil.getAdminRoleName());
+ AuthenticationUtil.runAs(authorisedWork, AuthenticationUtil.getAdminUserName());
// now we know everything worked ok, let the virtualisation server
// know about all the new workflow sandboxes created (just the main stores)
diff --git a/source/java/org/alfresco/repo/domain/hibernate/Permission.hbm.xml b/source/java/org/alfresco/repo/domain/hibernate/Permission.hbm.xml
index ced4516b58..19d5f679aa 100644
--- a/source/java/org/alfresco/repo/domain/hibernate/Permission.hbm.xml
+++ b/source/java/org/alfresco/repo/domain/hibernate/Permission.hbm.xml
@@ -461,7 +461,8 @@
]]>
-
+
+
SELECT
{n.*}
@@ -471,15 +472,14 @@
JOIN alf_child_assoc c on c.child_node_id = n.id
JOIN alf_store s on s.id = n.store_id
WHERE
- c.qname_localname = :userName1 AND
+ c.qname_localname = :userNameLowerCase AND
p.qname_id = :qnamePropId AND
- p.string_value = :userName2 AND
n.type_qname_id = :qnameTypeId AND
n.node_deleted = :False AND
s.protocol = :storeProtocol AND
s.identifier = :storeIdentifier
-
+
SELECT
diff --git a/source/java/org/alfresco/repo/security/authentication/AbstractAuthenticationComponent.java b/source/java/org/alfresco/repo/security/authentication/AbstractAuthenticationComponent.java
index 262e523117..596521e91d 100644
--- a/source/java/org/alfresco/repo/security/authentication/AbstractAuthenticationComponent.java
+++ b/source/java/org/alfresco/repo/security/authentication/AbstractAuthenticationComponent.java
@@ -40,6 +40,7 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.service.cmr.security.AuthorityType;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.transaction.TransactionService;
@@ -56,7 +57,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
* The abstract class keeps track of support for guest login
*/
private Boolean allowGuestLogin = null;
-
+
private TenantService tenantService;
private PersonService personService;
@@ -65,6 +66,8 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
private TransactionService transactionService;
+ private boolean autoCreatePeopleOnLogin = true;
+
public AbstractAuthenticationComponent()
{
super();
@@ -79,10 +82,10 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
{
this.allowGuestLogin = allowGuestLogin;
}
-
+
public void setTenantService(TenantService tenantService)
{
- this.tenantService = tenantService;
+ this.tenantService = tenantService;
}
public void setPersonService(PersonService personService)
@@ -120,6 +123,16 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
return personService;
}
+ public boolean isAutoCreatePeopleOnLogin()
+ {
+ return autoCreatePeopleOnLogin;
+ }
+
+ public void setAutoCreatePeopleOnLogin(boolean autoCreatePeopleOnLogin)
+ {
+ this.autoCreatePeopleOnLogin = autoCreatePeopleOnLogin;
+ }
+
public void authenticate(String userName, char[] password) throws AuthenticationException
{
// Support guest login from the login screen
@@ -148,7 +161,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
public Authentication setCurrentUser(String userName, UserNameValidationMode validationMode)
{
- switch(validationMode)
+ switch (validationMode)
{
case NONE:
return setCurrentUserImpl(userName);
@@ -157,7 +170,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
return setCurrentUser(userName);
}
}
-
+
public Authentication setCurrentUser(final String userName) throws AuthenticationException
{
if (isSystemUserName(userName))
@@ -232,8 +245,8 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
throw new AuthenticationException(ae.getMessage(), ae);
}
finally
- {
- // Support for logging tenantdomain / username (via log4j NDC)
+ {
+ // Support for logging tenantdomain / username (via log4j NDC)
AuthenticationUtil.logNDC(userName);
}
}
@@ -283,8 +296,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
}
/**
- * Set the system user as the current user
- * note: for MT, will set to default domain only
+ * Set the system user as the current user note: for MT, will set to default domain only
*
* @return Authentication
*/
@@ -294,8 +306,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
}
/**
- * Get the name of the system user
- * note: for MT, will get system for default domain only
+ * Get the name of the system user note: for MT, will get system for default domain only
*
* @return String
*/
@@ -303,20 +314,19 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
{
return AuthenticationUtil.SYSTEM_USER_NAME;
}
-
+
/**
* Is this the system user ?
- *
+ *
* @return boolean
- */
+ */
public boolean isSystemUserName(String userName)
{
- return (getSystemUserName().equals(tenantService.getBaseNameUser(userName)));
+ return (getSystemUserName().equals(tenantService.getBaseNameUser(userName)));
}
/**
- * Get the name of the Guest User
- * note: for MT, will get guest for default domain only
+ * Get the name of the Guest User note: for MT, will get guest for default domain only
*
* @return String
*/
@@ -327,18 +337,17 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
private String getGuestUserName(String tenantDomain)
{
- return tenantService.getDomainUser(getGuestUserName(), tenantDomain);
+ return tenantService.getDomainUser(getGuestUserName(), tenantDomain);
}
-
+
/**
- * Set the guest user as the current user.
- * note: for MT, will set to default domain only
+ * Set the guest user as the current user. note: for MT, will set to default domain only
*/
public Authentication setGuestUserAsCurrentUser() throws AuthenticationException
{
- return setGuestUserAsCurrentUser(TenantService.DEFAULT_DOMAIN);
+ return setGuestUserAsCurrentUser(TenantService.DEFAULT_DOMAIN);
}
-
+
/**
* Set the guest user as the current user.
*/
@@ -359,7 +368,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
{
if (allowGuestLogin.booleanValue())
{
- return setCurrentUser(getGuestUserName(tenantDomain));
+ return setCurrentUser(getGuestUserName(tenantDomain));
}
else
{
@@ -368,10 +377,10 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
}
}
-
+
private boolean isGuestUserName(String userName)
{
- return (PermissionService.GUEST_AUTHORITY.equalsIgnoreCase(tenantService.getBaseNameUser(userName)));
+ return (PermissionService.GUEST_AUTHORITY.equalsIgnoreCase(tenantService.getBaseNameUser(userName)));
}
protected abstract boolean implementationAllowsGuestLogin();
@@ -447,7 +456,8 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
NodeRef userNode = personService.getPerson(userName);
if (userNode != null)
{
- // Get the person name and use that as the current user to line up with permission checks
+ // Get the person name and use that as the current user to line up with permission
+ // checks
return (String) nodeService.getProperty(userNode, ContentModel.PROP_USERNAME);
}
else
@@ -458,12 +468,23 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
}
else
{
+ if (autoCreatePeopleOnLogin && (userName != null) && !userName.equals(AuthenticationUtil.getSystemUserName()))
+ {
+ if (personService.createMissingPeople())
+ {
+ AuthorityType authorityType = AuthorityType.getAuthorityType(userName);
+ if (authorityType == AuthorityType.USER)
+ {
+ personService.getPerson(userName);
+ }
+ }
+ }
// Get user name
return userName;
- }
+ }
}
- }, tenantService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantService.getUserDomain(userName)));
-
+ }, tenantService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantService.getUserDomain(userName)));
+
return setCurrentUserImpl(name);
}
catch (AuthenticationException ae)
diff --git a/source/java/org/alfresco/repo/security/authentication/AuthenticationTest.java b/source/java/org/alfresco/repo/security/authentication/AuthenticationTest.java
index f44ea52c54..0c260fb48b 100644
--- a/source/java/org/alfresco/repo/security/authentication/AuthenticationTest.java
+++ b/source/java/org/alfresco/repo/security/authentication/AuthenticationTest.java
@@ -245,7 +245,7 @@ public class AuthenticationTest extends TestCase
userName = pubAuthenticationService.getCurrentUserName();
assertEquals("andy", userName);
// get Person
- assertFalse(pubPersonService.personExists(userName));
+ assertTrue(pubPersonService.personExists(userName));
AuthenticationUtil.runAs(new RunAsWork() {
diff --git a/source/java/org/alfresco/repo/security/person/PersonDaoImpl.java b/source/java/org/alfresco/repo/security/person/PersonDaoImpl.java
index 20e7c65c0a..68718c7710 100644
--- a/source/java/org/alfresco/repo/security/person/PersonDaoImpl.java
+++ b/source/java/org/alfresco/repo/security/person/PersonDaoImpl.java
@@ -51,7 +51,7 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
public class PersonDaoImpl extends HibernateDaoSupport implements PersonDao
{
- private static final String QUERY_PERSON_GET_PERSON = "person.getPerson";
+ private static final String QUERY_PERSON_GET_PERSON_IGNORE_CASE = "person.getPersonIgnoreCase";
private static final String QUERY_PERSON_GET_ALL_PEOPLE = "person.getAllPeople";
@@ -75,9 +75,32 @@ public class PersonDaoImpl extends HibernateDaoSupport implements PersonDao
this.tenantService = tenantService;
}
+ public void init()
+ {
+ qNamePropId = qnameDAO.getOrCreateQName(ContentModel.PROP_USERNAME).getFirst();
+ qNameTypeId = qnameDAO.getOrCreateQName(ContentModel.TYPE_PERSON).getFirst();
+ }
+
@SuppressWarnings("unchecked")
public List getPersonOrNull(final String searchUserName, UserNameMatcher matcher)
{
+ /*
+ * Related JIRA:
+ * https://issues.alfresco.com/jira/browse/MOB-387
+ * https://issues.alfresco.com/jira/browse/ETHREEOH-1431
+ * https://issues.alfresco.com/jira/browse/ETWOTWO-1012
+ *
+ * When usernames are case-insensitive, it could happen that the DB is NOT.
+ * DB queries should therefore return values regardless of the DB collation.
+ * The original, case-preserving username is stored with the node properties.
+ * To solve the query issue, a LOWERCASE version of the username is stored on
+ * the path (alf_child_assoc.qname_localname). This is queried for using the
+ * lowercase version of the searched-for username. The case results pruning
+ * is done (as it always was) as a post-search task.
+ *
+ * Note that the upgrade scripts had to change to force lowercase names as well.
+ */
+
final StoreRef personStoreRef = tenantService.getName(storeRef);
List answer = new ArrayList();
@@ -86,11 +109,10 @@ public class PersonDaoImpl extends HibernateDaoSupport implements PersonDao
{
public Object doInHibernate(Session session)
{
- SQLQuery query = (SQLQuery) session.getNamedQuery(QUERY_PERSON_GET_PERSON);
+ SQLQuery query = (SQLQuery) session.getNamedQuery(QUERY_PERSON_GET_PERSON_IGNORE_CASE);
query.setParameter("qnamePropId", qNamePropId);
query.setParameter("qnameTypeId", qNameTypeId);
- query.setParameter("userName1", searchUserName);
- query.setParameter("userName2", searchUserName);
+ query.setParameter("userNameLowerCase", searchUserName.toLowerCase()); // Lowercase: ETHREEOH-1431
query.setParameter("False", Boolean.FALSE);
query.setParameter("storeProtocol", personStoreRef.getProtocol());
query.setParameter("storeIdentifier", personStoreRef.getIdentifier());
@@ -121,12 +143,6 @@ public class PersonDaoImpl extends HibernateDaoSupport implements PersonDao
}
- public void init()
- {
- qNamePropId = qnameDAO.getOrCreateQName(ContentModel.PROP_USERNAME).getFirst();
- qNameTypeId = qnameDAO.getOrCreateQName(ContentModel.TYPE_PERSON).getFirst();
- }
-
@SuppressWarnings("unchecked")
public Set getAllPeople()
{
diff --git a/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java b/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java
index 005f090909..66e70819f0 100644
--- a/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java
+++ b/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java
@@ -68,7 +68,6 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.GUID;
-import org.alfresco.util.Pair;
import org.alfresco.util.PropertyCheck;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -596,7 +595,11 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
properties.put(ContentModel.PROP_USERNAME, userName);
properties.put(ContentModel.PROP_SIZE_CURRENT, 0L);
- NodeRef personRef = nodeService.createNode(getPeopleContainer(), ContentModel.ASSOC_CHILDREN, QName.createQName("cm", userName, namespacePrefixResolver), ContentModel.TYPE_PERSON,
+ NodeRef personRef = nodeService.createNode(
+ getPeopleContainer(),
+ ContentModel.ASSOC_CHILDREN,
+ QName.createQName("cm", userName.toLowerCase(), namespacePrefixResolver), // Lowercase: ETHREEOH-1431
+ ContentModel.TYPE_PERSON,
properties).getChildRef();
return personRef;
}
diff --git a/source/java/org/alfresco/repo/security/person/UserNameMatcher.java b/source/java/org/alfresco/repo/security/person/UserNameMatcher.java
index 63652c68fa..c71acb2586 100644
--- a/source/java/org/alfresco/repo/security/person/UserNameMatcher.java
+++ b/source/java/org/alfresco/repo/security/person/UserNameMatcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2007 Alfresco Software Limited.
+ * Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -27,16 +27,12 @@ package org.alfresco.repo.security.person;
/**
* Check if userNames match
* @author andyh
- *
+ * @since 3.1
*/
public interface UserNameMatcher
{
/**
* Do the two user names match?
- *
- * @param userName1
- * @param userName2
- * @return
*/
public boolean matches(String userName1, String userName2);
diff --git a/source/java/org/alfresco/repo/tenant/MultiTAdminServiceImpl.java b/source/java/org/alfresco/repo/tenant/MultiTAdminServiceImpl.java
index 4ae010d79e..1b23041ff4 100755
--- a/source/java/org/alfresco/repo/tenant/MultiTAdminServiceImpl.java
+++ b/source/java/org/alfresco/repo/tenant/MultiTAdminServiceImpl.java
@@ -1,1254 +1,1254 @@
-/*
- * Copyright (C) 2005-2009 Alfresco Software Limited.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
- * As a special exception to the terms and conditions of version 2.0 of
- * the GPL, you may redistribute this Program in connection with Free/Libre
- * and Open Source Software ("FLOSS") applications as described in Alfresco's
- * FLOSS exception. You should have recieved a copy of the text describing
- * the FLOSS exception, and it is also available here:
- * http://www.alfresco.com/legal/licensing"
- */
-package org.alfresco.repo.tenant;
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-import javax.transaction.UserTransaction;
-
-import net.sf.acegisecurity.providers.encoding.PasswordEncoder;
-
-import org.alfresco.error.AlfrescoRuntimeException;
-import org.alfresco.repo.admin.RepoModelDefinition;
-import org.alfresco.repo.attributes.BooleanAttributeValue;
-import org.alfresco.repo.attributes.MapAttribute;
-import org.alfresco.repo.attributes.MapAttributeValue;
-import org.alfresco.repo.attributes.StringAttributeValue;
-import org.alfresco.repo.content.TenantRoutingFileContentStore;
-import org.alfresco.repo.dictionary.DictionaryComponent;
-import org.alfresco.repo.importer.ImporterBootstrap;
-import org.alfresco.repo.node.db.DbNodeServiceImpl;
-import org.alfresco.repo.security.authentication.AuthenticationComponent;
-import org.alfresco.repo.security.authentication.AuthenticationUtil;
-import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
-import org.alfresco.repo.site.SiteAVMBootstrap;
-import org.alfresco.repo.usage.UserUsageBootstrapJob;
-import org.alfresco.repo.usage.UserUsageTrackingComponent;
-import org.alfresco.repo.workflow.WorkflowDeployer;
-import org.alfresco.service.cmr.admin.RepoAdminService;
-import org.alfresco.service.cmr.attributes.AttributeService;
-import org.alfresco.service.cmr.module.ModuleService;
-import org.alfresco.service.cmr.repository.NodeService;
-import org.alfresco.service.cmr.repository.StoreRef;
-import org.alfresco.service.cmr.view.RepositoryExporterService;
-import org.alfresco.service.cmr.workflow.WorkflowDefinition;
-import org.alfresco.service.cmr.workflow.WorkflowService;
-import org.alfresco.service.transaction.TransactionService;
-import org.alfresco.util.ParameterCheck;
-import org.alfresco.util.PropertyCheck;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-/**
- * MT Admin Service Implementation.
- *
- */
-
-public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationContextAware
-{
- // Logger
- private static Log logger = LogFactory.getLog(MultiTAdminServiceImpl.class);
-
- // Keep hold of the app context
- private ApplicationContext ctx;
-
- // Dependencies
- private NodeService nodeService;
- private DictionaryComponent dictionaryComponent;
- private RepoAdminService repoAdminService;
- private AuthenticationComponent authenticationComponent;
- private TransactionService transactionService;
- private MultiTServiceImpl tenantService;
- private AttributeService attributeService;
- private PasswordEncoder passwordEncoder;
- private TenantRoutingFileContentStore tenantFileContentStore;
- private WorkflowService workflowService;
- private RepositoryExporterService repositoryExporterService;
- private ModuleService moduleService;
- private SiteAVMBootstrap siteAVMBootstrap;
- private List workflowDeployers = new ArrayList();
-
- private String baseAdminUsername = null;
-
- /*
- * Tenant domain/ids are unique strings that are case-insensitive. Tenant ids must be valid filenames.
- * They may also map onto domains and hence should allow valid FQDN.
- *
- * The following PCRE-style
- * regex defines a valid label within a FQDN:
- *
- * ^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$
- *
- * Less formally:
- *
- * o Case insensitive
- * o First/last character: alphanumeric
- * o Interior characters: alphanumeric plus hyphen
- * o Minimum length: 2 characters
- * o Maximum length: 63 characters
- *
- * The FQDN (fully qualified domain name) has the following constraints:
- *
- * o Maximum 255 characters (***)
- * o Must contain at least one alpha
- *
- * Note: (***) Due to various internal restrictions (such as store identifier) we restrict tenant ids to 75 characters.
- */
-
- protected final static String REGEX_VALID_DNS_LABEL = "^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$";
-
- protected final static String REGEX_CONTAINS_ALPHA = "^(.*)[a-zA-Z](.*)$";
-
- protected final static int MAX_LEN = 75;
-
- public void setNodeService(DbNodeServiceImpl dbNodeService)
- {
- this.nodeService = dbNodeService;
- }
-
- public void setDictionaryComponent(DictionaryComponent dictionaryComponent)
- {
- this.dictionaryComponent = dictionaryComponent;
- }
-
- public void setRepoAdminService(RepoAdminService repoAdminService)
- {
- this.repoAdminService = repoAdminService;
- }
-
- public void setAuthenticationComponent(AuthenticationComponent authenticationComponent)
- {
- this.authenticationComponent = authenticationComponent;
- }
-
- public void setTransactionService(TransactionService transactionService)
- {
- this.transactionService = transactionService;
- }
-
- public void setTenantService(MultiTServiceImpl tenantService)
- {
- this.tenantService = tenantService;
- }
-
- public void setAttributeService(AttributeService attributeService)
- {
- this.attributeService = attributeService;
- }
-
- public void setPasswordEncoder(PasswordEncoder passwordEncoder)
- {
- this.passwordEncoder = passwordEncoder;
- }
-
- public void setTenantFileContentStore(TenantRoutingFileContentStore tenantFileContentStore)
- {
- this.tenantFileContentStore = tenantFileContentStore;
- }
-
- public void setWorkflowService(WorkflowService workflowService)
- {
- this.workflowService = workflowService;
- }
-
- public void setRepositoryExporterService(RepositoryExporterService repositoryExporterService)
- {
- this.repositoryExporterService = repositoryExporterService;
- }
-
- /**
- * @deprecated see setWorkflowDeployers
- */
- public void setWorkflowDeployer(WorkflowDeployer workflowDeployer)
- {
- // NOOP
- logger.warn(WARN_MSG);
- }
-
- public void setModuleService(ModuleService moduleService)
- {
- this.moduleService = moduleService;
- }
-
- public void setSiteAVMBootstrap(SiteAVMBootstrap siteAVMBootstrap)
- {
- this.siteAVMBootstrap = siteAVMBootstrap;
- }
-
- public void setBaseAdminUsername(String baseAdminUsername)
- {
- this.baseAdminUsername = baseAdminUsername;
- }
-
- public static final String PROTOCOL_STORE_USER = "user";
- public static final String PROTOCOL_STORE_WORKSPACE = "workspace";
- public static final String PROTOCOL_STORE_SYSTEM = "system";
- public static final String PROTOCOL_STORE_ARCHIVE = "archive";
- public static final String STORE_BASE_ID_USER = "alfrescoUserStore";
- public static final String STORE_BASE_ID_SYSTEM = "system";
- public static final String STORE_BASE_ID_VERSION1 = "lightWeightVersionStore"; // deprecated
- public static final String STORE_BASE_ID_VERSION2 = "version2Store";
- public static final String STORE_BASE_ID_SPACES = "SpacesStore";
-
-
- private static final String TENANTS_ATTRIBUTE_PATH = "alfresco-tenants";
- private static final String TENANT_ATTRIBUTE_ENABLED = "enabled";
- private static final String TENANT_ROOT_CONTENT_STORE_DIR = "rootContentStoreDir";
-
- private List tenantDeployers = new ArrayList();
-
- private static final String WARN_MSG = "Please update your alfresco/extension/mt/mt-admin-context.xml to use baseMultiTAdminService (see latest alfresco/extension/mt/mt-admin-context.xml.sample)";
-
- protected void checkProperties()
- {
- if (moduleService == null || siteAVMBootstrap == null || baseAdminUsername == null)
- {
- logger.warn(WARN_MSG);
- }
- PropertyCheck.mandatory(this, "NodeService", nodeService);
- PropertyCheck.mandatory(this, "DictionaryComponent", dictionaryComponent);
- PropertyCheck.mandatory(this, "RepoAdminService", repoAdminService);
- PropertyCheck.mandatory(this, "TransactionService", transactionService);
- PropertyCheck.mandatory(this, "TenantService", tenantService);
- PropertyCheck.mandatory(this, "AttributeService", attributeService);
- PropertyCheck.mandatory(this, "PasswordEncoder", passwordEncoder);
- PropertyCheck.mandatory(this, "TenantFileContentStore", tenantFileContentStore);
- PropertyCheck.mandatory(this, "WorkflowService", workflowService);
- PropertyCheck.mandatory(this, "RepositoryExporterService", repositoryExporterService);
- PropertyCheck.mandatory(this, "siteAVMBootstrap", siteAVMBootstrap);
- PropertyCheck.mandatory(this, "moduleService", moduleService);
- PropertyCheck.mandatory(this, "baseAdminUsername", baseAdminUsername);
- }
-
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
- {
- this.ctx = applicationContext;
- }
-
- public void startTenants()
- {
- checkProperties();
-
- AuthenticationUtil.setMtEnabled(true);
-
- // initialise the tenant admin service and status of tenants (using attribute service)
- // note: this requires that the repository schema has already been initialised
-
- // register dictionary - to allow enable/disable tenant callbacks
- register(dictionaryComponent);
-
- // register file store - to allow enable/disable tenant callbacks
- register(tenantFileContentStore);
-
- UserTransaction userTransaction = transactionService.getUserTransaction();
-
- try
- {
- authenticationComponent.setSystemUserAsCurrentUser();
- userTransaction.begin();
-
- // bootstrap Tenant Service internal cache
- List tenants = getAllTenants();
-
- int enabledCount = 0;
- int disabledCount = 0;
-
- for (Tenant tenant : tenants)
- {
- if (tenant.isEnabled())
- {
- // this will also call tenant deployers registered so far ...
- enableTenant(tenant.getTenantDomain(), true);
- enabledCount++;
- }
- else
- {
- // explicitly disable, without calling disableTenant callback
- disableTenant(tenant.getTenantDomain(), false);
- disabledCount++;
- }
- }
-
- tenantService.register(this); // callback to refresh tenantStatus cache
-
- userTransaction.commit();
-
- if (logger.isInfoEnabled())
- {
- logger.info(String.format("Alfresco Multi-Tenant startup - %d enabled tenants, %d disabled tenants",
- enabledCount, disabledCount));
- }
- }
- catch(Throwable e)
- {
- // rollback the transaction
- try { if (userTransaction != null) {userTransaction.rollback();} } catch (Exception ex) {}
- throw new AlfrescoRuntimeException("Failed to bootstrap tenants", e);
- }
- finally
- {
- authenticationComponent.clearCurrentSecurityContext();
- }
- }
-
- public void stopTenants()
- {
- tenantDeployers.clear();
- tenantDeployers = null;
- }
-
- /**
- * @see TenantAdminService.createTenant()
- */
- public void createTenant(final String tenantDomain, final char[] tenantAdminRawPassword)
- {
- createTenant(tenantDomain, tenantAdminRawPassword, null);
- }
-
- /**
- * @see TenantAdminService.createTenant()
- */
- public void createTenant(final String tenantDomain, final char[] tenantAdminRawPassword, String rootContentStoreDir)
- {
- ParameterCheck.mandatory("tenantAdminRawPassword", tenantAdminRawPassword);
-
- initTenant(tenantDomain, rootContentStoreDir);
-
- try
- {
- // note: runAs would cause auditable property "creator" to be "admin" instead of "System@xxx"
- AuthenticationUtil.pushAuthentication();
- AuthenticationUtil.setFullyAuthenticatedUser(getSystemUser(tenantDomain));
-
- dictionaryComponent.init();
- tenantFileContentStore.init();
-
- // create tenant-specific stores
- ImporterBootstrap userImporterBootstrap = (ImporterBootstrap)ctx.getBean("userBootstrap");
- bootstrapUserTenantStore(userImporterBootstrap, tenantDomain, tenantAdminRawPassword);
-
- ImporterBootstrap systemImporterBootstrap = (ImporterBootstrap)ctx.getBean("systemBootstrap");
- bootstrapSystemTenantStore(systemImporterBootstrap, tenantDomain);
-
- // deprecated
- ImporterBootstrap versionImporterBootstrap = (ImporterBootstrap)ctx.getBean("versionBootstrap");
- bootstrapVersionTenantStore(versionImporterBootstrap, tenantDomain);
-
- ImporterBootstrap version2ImporterBootstrap = (ImporterBootstrap)ctx.getBean("version2Bootstrap");
- bootstrapVersionTenantStore(version2ImporterBootstrap, tenantDomain);
-
- ImporterBootstrap spacesArchiveImporterBootstrap = (ImporterBootstrap)ctx.getBean("spacesArchiveBootstrap");
- bootstrapSpacesArchiveTenantStore(spacesArchiveImporterBootstrap, tenantDomain);
-
- ImporterBootstrap spacesImporterBootstrap = (ImporterBootstrap)ctx.getBean("spacesBootstrap");
- bootstrapSpacesTenantStore(spacesImporterBootstrap, tenantDomain);
-
- siteAVMBootstrap.bootstrap();
-
- // notify listeners that tenant has been created & hence enabled
- for (TenantDeployer tenantDeployer : tenantDeployers)
- {
- tenantDeployer.onEnableTenant();
- }
-
- // bootstrap workflows
- for (WorkflowDeployer workflowDeployer : workflowDeployers)
- {
- workflowDeployer.init();
- }
-
- // bootstrap modules (if any)
- moduleService.startModules();
- }
- finally
- {
- AuthenticationUtil.popAuthentication();
- }
-
- logger.info("Tenant created: " + tenantDomain);
- }
-
- /**
- * Export tenant - equivalent to the tenant admin running a 'complete repo' export from the Web Client Admin
- */
- public void exportTenant(final String tenantDomain, final File directoryDestination)
- {
- AuthenticationUtil.runAs(new RunAsWork