diff --git a/source/java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizer.java b/source/java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizer.java index 639a5cf420..0717895e0e 100644 --- a/source/java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizer.java +++ b/source/java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizer.java @@ -450,12 +450,24 @@ public class ChainingUserRegistrySynchronizer extends AbstractLifecycleBean Object params[] = {authenticatorName}; throw new AuthenticationException("authentication.err.validation.authenticator.notfound", params); } - + /* * (non-Javadoc) * @see org.alfresco.repo.security.sync.UserRegistrySynchronizer#synchronize(boolean, boolean, boolean) */ + @Override public void synchronize(boolean forceUpdate, boolean isFullSync, final boolean splitTxns) + { + synchronizeInternal(forceUpdate, isFullSync, splitTxns); + } + + @Override + public void synchronize(boolean forceUpdate, boolean isFullSync) + { + synchronizeInternal(forceUpdate, isFullSync, true); + } + + private void synchronizeInternal(boolean forceUpdate, boolean isFullSync, final boolean splitTxns) { if (ChainingUserRegistrySynchronizer.logger.isDebugEnabled()) { @@ -1454,7 +1466,7 @@ public class ChainingUserRegistrySynchronizer extends AbstractLifecycleBean } } - public void processGroups(UserRegistry userRegistry, boolean isFullSync, boolean splitTxns) + private void processGroups(UserRegistry userRegistry, boolean isFullSync, boolean splitTxns) { // If we got back some groups, we have to cross reference them with the set of known authorities if (isFullSync || !this.groupParentAssocsToDelete.isEmpty() @@ -1634,7 +1646,7 @@ public class ChainingUserRegistrySynchronizer extends AbstractLifecycleBean } } - public void finalizeAssociations(UserRegistry userRegistry, boolean splitTxns) + private void finalizeAssociations(UserRegistry userRegistry, boolean splitTxns) { // First validate the group associations to be created for potential cycles. Remove any offending association validateGroupParentAssocsToCreate(); diff --git a/source/java/org/alfresco/repo/security/sync/UserRegistrySynchronizer.java b/source/java/org/alfresco/repo/security/sync/UserRegistrySynchronizer.java index b48f827b55..e6062b7d32 100644 --- a/source/java/org/alfresco/repo/security/sync/UserRegistrySynchronizer.java +++ b/source/java/org/alfresco/repo/security/sync/UserRegistrySynchronizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2010 Alfresco Software Limited. + * Copyright (C) 2005-2013 Alfresco Software Limited. * * This file is part of Alfresco * @@ -45,6 +45,9 @@ public interface UserRegistrySynchronizer * Retrieves timestamped user and group information from configured external sources and compares it with the local * users and groups last retrieved from the same sources. Any updates and additions made to those users and groups * are applied to the local Alfresco copies. + *
+ * This method is deprecated, use {@link #synchronize(boolean forceUpdate, boolean isFullSync)} instead. + *
* * @param forceUpdate * Should the complete set of users and groups be updated / created locally or just those known to have @@ -62,8 +65,28 @@ public interface UserRegistrySynchronizer *false
, all users and groups are processed in the current transaction. This is required if
* calling synchronously (e.g. in response to an authentication event in the same transaction).
*/
+ @Deprecated
public void synchronize(boolean forceUpdate, boolean isFullSync, boolean splitTxns);
-
+
+ /**
+ * Retrieves timestamped user and group information from configured external sources and compares it with the local
+ * users and groups last retrieved from the same sources. Any updates and additions made to those users and groups
+ * are applied to the local Alfresco copies. Unlike deprecated {@link #synchronize(boolean, boolean, boolean)},
+ * this process is always run in different transactions and threads.
+ *
+ * @param forceUpdate
+ * Should the complete set of users and groups be updated / created locally or just those known to have
+ * changed since the last sync? When true
then all users and groups are queried from
+ * the user registry and updated locally. When false
then each source is only queried for
+ * those users and groups modified since the most recent modification date of all the objects last
+ * queried from that same source.
+ * @param isFullSync
+ * Should a complete set of user and group IDs be queried from the user registries in order to determine
+ * deletions? This parameter is independent of force
as a separate query is run to process
+ * updates.
+ */
+ public void synchronize(boolean forceUpdate, boolean isFullSync);
+
/**
* Gets the set of property names that are auto-mapped for the user with the given user name. These should remain
* read-only for the user in the UI.
diff --git a/source/test-java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizerTest.java b/source/test-java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizerTest.java
index dbefa639b9..abd08dcb18 100644
--- a/source/test-java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizerTest.java
+++ b/source/test-java/org/alfresco/repo/security/sync/ChainingUserRegistrySynchronizerTest.java
@@ -312,7 +312,8 @@ public class ChainingUserRegistrySynchronizerTest extends TestCase
{
public Void doWork() throws Exception
{
- ChainingUserRegistrySynchronizerTest.this.synchronizer.synchronize(false, false, false);
+ // Split transactions to avoid MNT-9768
+ ChainingUserRegistrySynchronizerTest.this.synchronizer.synchronize(false, false);
return null;
}
});