diff --git a/README.md b/README.md
index d9ec3f30..f40acea2 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ See also our talk at [AdaptTo 2016](https://adapt.to/2016/en/schedule/ac-tool.ht
# Requirements
-The AC Tool requires Java 7 and AEM 6.1 or above (use v1.x for older versions)
+The AC Tool requires Java 7 and AEM 6.1 (SP1) or above (use v1.x for older versions)
# Installation
diff --git a/accesscontroltool-bundle/pom.xml b/accesscontroltool-bundle/pom.xml
index 2eecb559..be61b31a 100644
--- a/accesscontroltool-bundle/pom.xml
+++ b/accesscontroltool-bundle/pom.xml
@@ -11,7 +11,7 @@
biz.netcentric.cq.tools.accesscontroltool
accesscontroltool
- 2.0.3
+ 2.0.4
@@ -103,6 +103,10 @@
com.day.cq
cq-commons
+
+ com.adobe.granite
+ com.adobe.granite.crypto
+
org.yaml
snakeyaml
diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstaller.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstaller.java
index 4c0275f9..8c9f3d11 100644
--- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstaller.java
+++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstaller.java
@@ -13,8 +13,9 @@
import javax.jcr.Session;
+import biz.netcentric.cq.tools.actool.configmodel.AcConfiguration;
import biz.netcentric.cq.tools.actool.configmodel.AceBean;
-import biz.netcentric.cq.tools.actool.history.AcInstallationLog;
+import biz.netcentric.cq.tools.actool.history.InstallationLogger;
/** Installs AceBeans to content paths. */
public interface AceBeanInstaller {
@@ -28,7 +29,7 @@ public interface AceBeanInstaller {
* @param installationLog the installation log
* @param authorizablesToRemoveAcesFor
* @param intermediateSaves whether the session should be saved after each path (for each ACL) */
- void installPathBasedACEs(final Map> pathBasedAceMapFromConfig, final Session session,
- final AcInstallationLog installationLog, Set authorizablesToRemoveAcesFor, boolean intermediateSaves) throws Exception;
+ void installPathBasedACEs(final Map> pathBasedAceMapFromConfig, final AcConfiguration acConfiguration, final Session session,
+ final InstallationLogger installationLog, Set authorizablesToRemoveAcesFor, boolean intermediateSaves) throws Exception;
}
\ No newline at end of file
diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstallerClassic.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstallerClassic.java
index 8e234d57..98269e53 100644
--- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstallerClassic.java
+++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstallerClassic.java
@@ -40,7 +40,7 @@
import biz.netcentric.cq.tools.actool.configmodel.AceBean;
import biz.netcentric.cq.tools.actool.helper.AccessControlUtils;
import biz.netcentric.cq.tools.actool.helper.RestrictionsHolder;
-import biz.netcentric.cq.tools.actool.history.AcInstallationLog;
+import biz.netcentric.cq.tools.actool.history.InstallationLogger;
/** The way ACEs were installed in version one is still available and can be configured in "global_config" section by setting
* "installAclsIncrementally=false". */
@@ -54,7 +54,7 @@ public class AceBeanInstallerClassic extends BaseAceBeanInstaller implements Ace
*
* @throws RepositoryException */
protected void installAcl(Set aceBeanSetFromConfig, String path, Set principalsToRemoveAcesFor, Session session,
- AcInstallationLog installLog) throws RepositoryException {
+ InstallationLogger installLog) throws RepositoryException {
// Remove all config contained authorizables from ACL of this path
int countRemoved = AccessControlUtils.deleteAllEntriesForPrincipalsFromACL(session,
@@ -80,7 +80,7 @@ protected void installAcl(Set aceBeanSetFromConfig, String path, Set actionMap = aceBean.getActionMap();
if (actionMap.isEmpty()) {
return acl;
diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstallerIncremental.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstallerIncremental.java
index 6b392f64..052ac407 100644
--- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstallerIncremental.java
+++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstallerIncremental.java
@@ -49,7 +49,7 @@
import biz.netcentric.cq.tools.actool.helper.AcHelper;
import biz.netcentric.cq.tools.actool.helper.AccessControlUtils;
import biz.netcentric.cq.tools.actool.helper.Constants;
-import biz.netcentric.cq.tools.actool.history.AcInstallationLog;
+import biz.netcentric.cq.tools.actool.history.InstallationLogger;
@Service
@Component
@@ -66,7 +66,7 @@ public class AceBeanInstallerIncremental extends BaseAceBeanInstaller implements
*
* @throws RepositoryException */
protected void installAcl(Set aceBeanSetFromConfig, String path, Set principalsInConfiguration, Session session,
- AcInstallationLog installLog) throws RepositoryException {
+ InstallationLogger installLog) throws RepositoryException {
boolean hadPendingChanges = session.hasPendingChanges();
@@ -210,7 +210,7 @@ protected JackrabbitAccessControlList getAccessControlList(AccessControlManager
}
private Set transformActionsIntoPrivileges(Set aceBeanSetFromConfig, Session session,
- AcInstallationLog installLog) throws RepositoryException {
+ InstallationLogger installLog) throws RepositoryException {
Set aceBeanSetWithPrivilegesOnly = new LinkedHashSet();
@@ -230,7 +230,7 @@ private Set transformActionsIntoPrivileges(Set aceBeanSetFromC
}
private Set getPrincipalAceBeansForActionAceBeanCached(AceBean origAceBean, Session session,
- AcInstallationLog installLog) throws RepositoryException {
+ InstallationLogger installLog) throws RepositoryException {
String cacheKey = (definesContent(origAceBean.getJcrPathForPolicyApi(), session) ? "definesContent" : "simple")
+ "-" + origAceBean.getPermission() + "-" + getRestrictionsComparable(origAceBean.getRestrictions()) + "-"
diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/BaseAceBeanInstaller.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/BaseAceBeanInstaller.java
index eda155b5..d06385e2 100644
--- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/BaseAceBeanInstaller.java
+++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/BaseAceBeanInstaller.java
@@ -8,7 +8,7 @@
*/
package biz.netcentric.cq.tools.actool.aceinstaller;
-import static biz.netcentric.cq.tools.actool.history.AcInstallationLog.msHumanReadable;
+import static biz.netcentric.cq.tools.actool.history.PersistableInstallationLogger.msHumanReadable;
import java.security.Principal;
import java.util.Arrays;
@@ -33,12 +33,13 @@
import org.slf4j.LoggerFactory;
import biz.netcentric.cq.tools.actool.comparators.AcePermissionComparator;
+import biz.netcentric.cq.tools.actool.configmodel.AcConfiguration;
import biz.netcentric.cq.tools.actool.configmodel.AceBean;
import biz.netcentric.cq.tools.actool.configmodel.Restriction;
import biz.netcentric.cq.tools.actool.helper.AccessControlUtils;
import biz.netcentric.cq.tools.actool.helper.ContentHelper;
import biz.netcentric.cq.tools.actool.helper.RestrictionsHolder;
-import biz.netcentric.cq.tools.actool.history.AcInstallationLog;
+import biz.netcentric.cq.tools.actool.history.InstallationLogger;
/** Base Class */
public abstract class BaseAceBeanInstaller implements AceBeanInstaller {
@@ -48,8 +49,9 @@ public abstract class BaseAceBeanInstaller implements AceBeanInstaller {
@Override
public void installPathBasedACEs(
final Map> pathBasedAceMapFromConfig,
+ final AcConfiguration acConfiguration,
final Session session,
- final AcInstallationLog history, Set principalsToRemoveAcesFor,
+ final InstallationLogger history, Set principalsToRemoveAcesFor,
boolean intermediateSaves) throws Exception {
StopWatch stopWatch = new StopWatch();
@@ -86,7 +88,7 @@ public void installPathBasedACEs(
new AcePermissionComparator());
orderedAceBeanSetFromConfig.addAll(aceBeanSetFromConfig);
- Set principalsToRemoveAcesForAtThisPath = history.getAcConfiguration().getAuthorizablesConfig()
+ Set principalsToRemoveAcesForAtThisPath = acConfiguration.getAuthorizablesConfig()
.removeUnmanagedPrincipalNamesAtPath(path, principalsToRemoveAcesFor);
installAcl(orderedAceBeanSetFromConfig, path, principalsToRemoveAcesForAtThisPath, session, history);
@@ -101,18 +103,18 @@ public void installPathBasedACEs(
+ " parent paths missing for creation of intial content (those paths were skipped, see verbose log for details)");
}
- history.addMessage(LOG, "Finished installation of " + paths.size() + " ACLs in "
- + msHumanReadable(stopWatch.getTime())
- + " (changed ACLs=" + history.getCountAclsChanged() + " unchanged ACLs=" + history.getCountAclsUnchanged()
- + " path does not exist=" + history.getCountAclsPathDoesNotExist() + " action cache hit/miss="
+ history.addMessage(LOG, "ACL Update Statistics: Changed=" + history.getCountAclsChanged() + " Unchanged=" + history.getCountAclsUnchanged()
+ + " Path not found=" + history.getCountAclsPathDoesNotExist() + " (action cache hit/miss="
+ history.getCountActionCacheHit() + "/" + history.getCountActionCacheMiss() + ")");
+ history.addMessage(LOG, "*** Finished installation of " + paths.size() + " ACLs in "
+ + msHumanReadable(stopWatch.getTime()));
}
/** Installs a full set of ACE beans that form an ACL for the path
*
* @throws RepositoryException */
protected abstract void installAcl(Set aceBeanSetFromConfig, String path, Set authorizablesToRemoveAcesFor,
- Session session, AcInstallationLog history) throws RepositoryException;
+ Session session, InstallationLogger history) throws RepositoryException;
protected boolean installPrivileges(AceBean aceBean, Principal principal, JackrabbitAccessControlList acl, Session session,
diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/api/InstallationLog.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/api/InstallationLog.java
index 5ed8f14b..3d4a6111 100644
--- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/api/InstallationLog.java
+++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/api/InstallationLog.java
@@ -10,14 +10,20 @@
import biz.netcentric.cq.tools.actool.installationhistory.AcInstallationHistoryPojo;
+/**
+ * Access to log messages being emitted
+ *
+ */
public interface InstallationLog extends AcInstallationHistoryPojo {
+ // This is only set for the installhook mechanism
String getCrxPackageName();
String getMessageHistory();
String getVerboseMessageHistory();
-
+
+ // TODO: move to separate interface InstallationResult which extends this interface
int getCountAclsUnchanged();
int getCountAclsChanged();
diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/AuthorizableInstallerService.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/AuthorizableInstallerService.java
index fa71ea57..5712c952 100644
--- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/AuthorizableInstallerService.java
+++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/AuthorizableInstallerService.java
@@ -11,13 +11,17 @@
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import com.adobe.granite.crypto.CryptoException;
+
+import biz.netcentric.cq.tools.actool.configmodel.AcConfiguration;
import biz.netcentric.cq.tools.actool.configmodel.AuthorizablesConfig;
-import biz.netcentric.cq.tools.actool.history.AcInstallationLog;
+import biz.netcentric.cq.tools.actool.history.InstallationLogger;
public interface AuthorizableInstallerService {
- public void installAuthorizables(
- AuthorizablesConfig principalMapFromConfig,
- final Session session, AcInstallationLog installLog) throws RepositoryException, AuthorizableCreatorException;
-
+ void installAuthorizables(
+ AcConfiguration acConfiguration,
+ AuthorizablesConfig authorizablesConfigBeans,
+ final Session session, InstallationLogger installLog)
+ throws RepositoryException, AuthorizableCreatorException, CryptoException;
}
diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/impl/AuthorizableInstallerServiceImpl.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/impl/AuthorizableInstallerServiceImpl.java
index 8dd6626e..32af8267 100644
--- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/impl/AuthorizableInstallerServiceImpl.java
+++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/impl/AuthorizableInstallerServiceImpl.java
@@ -37,15 +37,19 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.adobe.granite.crypto.CryptoException;
+import com.adobe.granite.crypto.CryptoSupport;
+
import biz.netcentric.cq.tools.actool.authorizableinstaller.AuthorizableCreatorException;
import biz.netcentric.cq.tools.actool.authorizableinstaller.AuthorizableInstallerService;
+import biz.netcentric.cq.tools.actool.configmodel.AcConfiguration;
import biz.netcentric.cq.tools.actool.configmodel.AuthorizableConfigBean;
import biz.netcentric.cq.tools.actool.configmodel.AuthorizablesConfig;
import biz.netcentric.cq.tools.actool.helper.AcHelper;
import biz.netcentric.cq.tools.actool.helper.AccessControlUtils;
import biz.netcentric.cq.tools.actool.helper.Constants;
import biz.netcentric.cq.tools.actool.helper.ContentHelper;
-import biz.netcentric.cq.tools.actool.history.AcInstallationLog;
+import biz.netcentric.cq.tools.actool.history.InstallationLogger;
@Service
@Component(metatype = true, label = "AC AuthorizableCreatorService", description = "Service that installs groups according to textual configuration files")
@@ -65,16 +69,20 @@ public class AuthorizableInstallerServiceImpl implements
@Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY)
ExternalGroupInstallerServiceImpl externalGroupCreatorService;
+ @Reference
+ CryptoSupport cryptoSupport;
+
@Override
public void installAuthorizables(
+ AcConfiguration acConfiguration,
AuthorizablesConfig authorizablesConfigBeans,
- final Session session, AcInstallationLog installLog)
- throws RepositoryException, AuthorizableCreatorException {
+ final Session session, InstallationLogger installLog)
+ throws RepositoryException, AuthorizableCreatorException, CryptoException {
Set authorizablesFromConfigurations = authorizablesConfigBeans.getAuthorizableIds();
for (AuthorizableConfigBean authorizableConfigBean : authorizablesConfigBeans) {
- installAuthorizableConfigurationBean(session,
+ installAuthorizableConfigurationBean(session, acConfiguration,
authorizableConfigBean, installLog, authorizablesFromConfigurations);
}
@@ -83,11 +91,12 @@ public void installAuthorizables(
private void installAuthorizableConfigurationBean(final Session session,
+ AcConfiguration acConfiguration,
AuthorizableConfigBean authorizableConfigBean,
- AcInstallationLog installLog, Set authorizablesFromConfigurations)
+ InstallationLogger installLog, Set authorizablesFromConfigurations)
throws AccessDeniedException,
UnsupportedRepositoryOperationException, RepositoryException,
- AuthorizableExistsException, AuthorizableCreatorException {
+ AuthorizableExistsException, AuthorizableCreatorException, CryptoException {
String authorizableId = authorizableConfigBean.getAuthorizableId();
LOG.debug("- start installation of authorizable: {}", authorizableId);
@@ -98,7 +107,7 @@ private void installAuthorizableConfigurationBean(final Session session,
// if current authorizable from config doesn't exist yet
Authorizable authorizableToInstall = userManager.getAuthorizable(authorizableId);
if (authorizableToInstall == null) {
- authorizableToInstall = createNewAuthorizable(authorizableConfigBean, installLog, userManager, session);
+ authorizableToInstall = createNewAuthorizable(acConfiguration, authorizableConfigBean, installLog, userManager, session);
}
// if current authorizable from config already exists in repository
else {
@@ -108,17 +117,17 @@ private void installAuthorizableConfigurationBean(final Session session,
// update password for users
if (!authorizableToInstall.isGroup() && !authorizableConfigBean.isSystemUser()
&& StringUtils.isNotBlank(authorizableConfigBean.getPassword())) {
- ((User) authorizableToInstall).changePassword(authorizableConfigBean.getPassword());
+ setUserPassword(authorizableConfigBean, (User) authorizableToInstall);
}
// move authorizable if path changed (retaining existing members)
- handleRecreationOfAuthorizableIfNecessary(session, authorizableConfigBean, installLog, userManager);
+ handleRecreationOfAuthorizableIfNecessary(session, acConfiguration, authorizableConfigBean, installLog, userManager);
- applyGroupMembershipConfigIsMemberOf(installLog, authorizableConfigBean, userManager, session, authorizablesFromConfigurations);
+ applyGroupMembershipConfigIsMemberOf(installLog, acConfiguration, authorizableConfigBean, userManager, session, authorizablesFromConfigurations);
}
- applyGroupMembershipConfigMembers(authorizableConfigBean, installLog, authorizableId, userManager, authorizablesFromConfigurations);
+ applyGroupMembershipConfigMembers(acConfiguration, authorizableConfigBean, installLog, authorizableId, userManager, authorizablesFromConfigurations);
if (StringUtils.isNotBlank(authorizableConfigBean.getMigrateFrom()) && authorizableConfigBean.isGroup()) {
migrateFromOldGroup(authorizableConfigBean, userManager, installLog);
@@ -126,11 +135,21 @@ private void installAuthorizableConfigurationBean(final Session session,
}
+ void setUserPassword(final AuthorizableConfigBean authorizableConfigBean,
+ final User authorizableToInstall) throws RepositoryException, CryptoException {
+ String password = authorizableConfigBean.getPassword();
+ if (password.matches("\\{.+}")) {
+ password = cryptoSupport.unprotect(password);
+ }
+ authorizableToInstall.changePassword(password);
+ }
+
+
/** This is only relevant for members that point to groups/users not contained in configuration.
* {@link biz.netcentric.cq.tools.actool.configreader.YamlConfigurationMerger#ensureIsMemberOfIsUsedWherePossible()} ensures that
* regular relationships between groups contained in config are kept in isMemberOf */
@SuppressWarnings("unchecked")
- void applyGroupMembershipConfigMembers(AuthorizableConfigBean authorizableConfigBean, AcInstallationLog installLog,
+ void applyGroupMembershipConfigMembers(AcConfiguration acConfiguration, AuthorizableConfigBean authorizableConfigBean, InstallationLogger installLog,
String principalId, UserManager userManager, Set authorizablesFromConfigurations) throws RepositoryException {
if (authorizableConfigBean.isGroup()) {
String[] membersInConfigArr = authorizableConfigBean.getMembers();
@@ -146,7 +165,7 @@ void applyGroupMembershipConfigMembers(AuthorizableConfigBean authorizableConfig
// ensure regular users are never removed
relevantMembersInRepo = removeRegularUsers(relevantMembersInRepo, userManager);
// take configuration 'defaultUnmanagedExternalMembersRegex' into account (and remove matching groups from further handling)
- relevantMembersInRepo = removeExternalMembersUnmanagedByConfiguration(authorizableConfigBean, relevantMembersInRepo,
+ relevantMembersInRepo = removeExternalMembersUnmanagedByConfiguration(acConfiguration, authorizableConfigBean, relevantMembersInRepo,
installLog);
Set membersToAdd = new HashSet(CollectionUtils.subtract(membersInConfig, relevantMembersInRepo));
@@ -202,10 +221,10 @@ private Set removeRegularUsers(Set allMembersFromRepo, UserManag
return relevantMembers;
}
- private Set removeExternalMembersUnmanagedByConfiguration(AuthorizableConfigBean authorizableConfigBean,
- Set relevantMembersInRepo, AcInstallationLog installLog) {
+ private Set removeExternalMembersUnmanagedByConfiguration(AcConfiguration acConfiguration, AuthorizableConfigBean authorizableConfigBean,
+ Set relevantMembersInRepo, InstallationLogger installLog) {
Set relevantMembers = new HashSet(relevantMembersInRepo);
- Pattern unmanagedExternalMembersRegex = installLog.getAcConfiguration().getGlobalConfiguration()
+ Pattern unmanagedExternalMembersRegex = acConfiguration.getGlobalConfiguration()
.getDefaultUnmanagedExternalMembersRegex();
Set unmanagedMembers = new HashSet();
@@ -240,7 +259,7 @@ private Set getDeclaredMembers(Group installedGroup) throws RepositoryEx
}
private void migrateFromOldGroup(AuthorizableConfigBean authorizableConfigBean, UserManager userManager,
- AcInstallationLog installLog) throws RepositoryException {
+ InstallationLogger installLog) throws RepositoryException {
Authorizable groupForMigration = userManager.getAuthorizable(authorizableConfigBean.getMigrateFrom());
String authorizableId = authorizableConfigBean.getAuthorizableId();
@@ -284,8 +303,9 @@ private void migrateFromOldGroup(AuthorizableConfigBean authorizableConfigBean,
}
private void handleRecreationOfAuthorizableIfNecessary(final Session session,
+ AcConfiguration acConfiguration,
AuthorizableConfigBean principalConfigBean,
- AcInstallationLog installLog,
+ InstallationLogger installLog,
UserManager userManager) throws RepositoryException, AuthorizableCreatorException {
String authorizableId = principalConfigBean.getAuthorizableId();
@@ -341,7 +361,7 @@ private void handleRecreationOfAuthorizableIfNecessary(final Session session,
existingAuthorizable.remove();
// create group again using values form config
- Authorizable newAuthorizable = createNewAuthorizable(principalConfigBean, installLog, userManager, session);
+ Authorizable newAuthorizable = createNewAuthorizable(acConfiguration, principalConfigBean, installLog, userManager, session);
int countMovedMembersOfGroup = 0;
if (newAuthorizable.isGroup()) {
@@ -388,7 +408,8 @@ private void deleteOldIntermediatePath(final Session session,
}
}
- private void applyGroupMembershipConfigIsMemberOf(AcInstallationLog installLog,
+ private void applyGroupMembershipConfigIsMemberOf(InstallationLogger installLog,
+ AcConfiguration acConfiguration,
AuthorizableConfigBean authorizableConfigBean, UserManager userManager, Session session,
Set authorizablesFromConfigurations) throws RepositoryException, AuthorizableCreatorException {
String[] memberOf = authorizableConfigBean.getMemberOf();
@@ -398,13 +419,14 @@ private void applyGroupMembershipConfigIsMemberOf(AcInstallationLog installLog,
Set membershipGroupsFromConfig = getMembershipGroupsFromConfig(memberOf);
Set membershipGroupsFromRepository = getMembershipGroupsFromRepository(currentGroupFromRepository);
- applyGroupMembershipConfigIsMemberOf(authorizableId, installLog, userManager, session, membershipGroupsFromConfig,
+ applyGroupMembershipConfigIsMemberOf(authorizableId, acConfiguration, installLog, userManager, session, membershipGroupsFromConfig,
membershipGroupsFromRepository, authorizablesFromConfigurations);
}
private Authorizable createNewAuthorizable(
+ AcConfiguration acConfiguration,
AuthorizableConfigBean principalConfigBean,
- AcInstallationLog installLog,
+ InstallationLogger installLog,
UserManager userManager, Session session)
throws AuthorizableExistsException, RepositoryException,
AuthorizableCreatorException {
@@ -415,7 +437,7 @@ private Authorizable createNewAuthorizable(
Authorizable newAuthorizable = null;
if (isGroup) {
- newAuthorizable = createNewGroup(userManager, principalConfigBean, installLog, session);
+ newAuthorizable = createNewGroup(userManager, acConfiguration.getAuthorizablesConfig(), principalConfigBean, installLog, session);
LOG.info("Successfully created new group: {}", authorizableId);
} else {
if (StringUtils.isNotEmpty(principalConfigBean.getExternalId())) {
@@ -424,7 +446,7 @@ private Authorizable createNewAuthorizable(
+ "') - use a ootb sync handler to have users automatically created.");
}
- newAuthorizable = createNewUser(userManager, principalConfigBean, installLog, session);
+ newAuthorizable = createNewUser(userManager, acConfiguration.getAuthorizablesConfig(), principalConfigBean, installLog, session);
LOG.info("Successfully created new user: {}", authorizableId);
}
@@ -458,7 +480,8 @@ private Set getMembershipGroupsFromConfig(String[] memberOf) {
@SuppressWarnings("unchecked")
void applyGroupMembershipConfigIsMemberOf(String authorizableId,
- AcInstallationLog installLog, UserManager userManager, Session session,
+ AcConfiguration acConfiguration,
+ InstallationLogger installLog, UserManager userManager, Session session,
Set membershipGroupsFromConfig,
Set membershipGroupsFromRepository, Set authorizablesFromConfigurations)
throws RepositoryException, AuthorizableExistsException,
@@ -471,7 +494,7 @@ void applyGroupMembershipConfigIsMemberOf(String authorizableId,
installLog.addVerboseMessage(LOG, "Authorizable " + authorizableId + " isMemberOf(repo)=" + membershipGroupsFromRepository);
installLog.addVerboseMessage(LOG, "Authorizable " + authorizableId + " isMemberOf(conifg)=" + membershipGroupsFromConfig);
- Set validatedMembershipGroupsFromConfig = validateAssignedGroups(userManager, session, authorizableId,
+ Set validatedMembershipGroupsFromConfig = validateAssignedGroups(userManager, acConfiguration.getAuthorizablesConfig(), session, authorizableId,
membershipGroupsFromConfig, installLog);
Collection unChangedMembers = CollectionUtils.intersection(membershipGroupsFromRepository,
@@ -485,7 +508,7 @@ void applyGroupMembershipConfigIsMemberOf(String authorizableId,
validatedMembershipGroupsFromConfig);
Set unmanagedMembers = new HashSet();
- Pattern unmanagedExternalIsMemberOfRegex = installLog.getAcConfiguration().getGlobalConfiguration()
+ Pattern unmanagedExternalIsMemberOfRegex = acConfiguration.getGlobalConfiguration()
.getDefaultUnmanagedExternalIsMemberOfRegex();
Iterator toBeRemovedMembersIt = toBeRemovedMembers.iterator();
@@ -532,8 +555,9 @@ void applyGroupMembershipConfigIsMemberOf(String authorizableId,
private Authorizable createNewGroup(
final UserManager userManager,
+ AuthorizablesConfig authorizablesConfig,
AuthorizableConfigBean principalConfigBean,
- AcInstallationLog installLog, Session session)
+ InstallationLogger installLog, Session session)
throws AuthorizableExistsException, RepositoryException,
AuthorizableCreatorException {
@@ -567,14 +591,14 @@ private Authorizable createNewGroup(
newGroup = (Group) userManager.getAuthorizable(groupID);
}
- addMembersToReferencingAuthorizables(newGroup, principalConfigBean, userManager, session, installLog);
+ addMembersToReferencingAuthorizables(newGroup, authorizablesConfig, principalConfigBean, userManager, session, installLog);
setAuthorizableProperties(newGroup, principalConfigBean, session, installLog);
return newGroup;
}
void setAuthorizableProperties(Authorizable authorizable, AuthorizableConfigBean principalConfigBean,
- Session session, AcInstallationLog installationLog)
+ Session session, InstallationLogger installationLog)
throws RepositoryException {
String profileContent = principalConfigBean.getProfileContent();
@@ -639,8 +663,9 @@ void setAuthorizableProperties(Authorizable authorizable, AuthorizableConfigBean
private Authorizable createNewUser(
final UserManager userManager,
+ AuthorizablesConfig authorizablesConfig,
AuthorizableConfigBean principalConfigBean,
- AcInstallationLog installLog,
+ InstallationLogger installLog,
Session session)
throws AuthorizableExistsException, RepositoryException,
AuthorizableCreatorException {
@@ -662,19 +687,19 @@ private Authorizable createNewUser(
}
setAuthorizableProperties(newUser, principalConfigBean, session, installLog);
- addMembersToReferencingAuthorizables(newUser, principalConfigBean, userManager, session, installLog);
+ addMembersToReferencingAuthorizables(newUser, authorizablesConfig, principalConfigBean, userManager, session, installLog);
return newUser;
}
- private void addMembersToReferencingAuthorizables(Authorizable authorizable, AuthorizableConfigBean principalConfigBean,
- final UserManager userManager, Session session, AcInstallationLog installLog)
+ private void addMembersToReferencingAuthorizables(Authorizable authorizable, AuthorizablesConfig authorizablesConfig, AuthorizableConfigBean principalConfigBean,
+ final UserManager userManager, Session session, InstallationLogger installLog)
throws RepositoryException, AuthorizableCreatorException {
String authorizableId = principalConfigBean.getAuthorizableId();
String[] memberOf = principalConfigBean.getMemberOf();
if ((authorizable != null) && (memberOf != null) && (memberOf.length > 0)) {
// add group to groups according to configuration
- Set referencingAuthorizablesToBeChanged = validateAssignedGroups(userManager, session, authorizableId,
+ Set referencingAuthorizablesToBeChanged = validateAssignedGroups(userManager, authorizablesConfig, session, authorizableId,
new HashSet(Arrays.asList(memberOf)), installLog);
if (!referencingAuthorizablesToBeChanged.isEmpty()) {
LOG.debug("start adding {} to assignedGroups", authorizableId);
@@ -700,8 +725,8 @@ private void addMembersToReferencingAuthorizables(Authorizable authorizable, Aut
* @throws RepositoryException
* @throws AuthorizableCreatorException if one of the authorizables contained in membersOf array is a user */
Set validateAssignedGroups(
- final UserManager userManager, Session session, final String authorizablelId,
- final Set isMemberOf, AcInstallationLog installLog) throws RepositoryException,
+ final UserManager userManager, AuthorizablesConfig authorizablesConfig, Session session, final String authorizablelId,
+ final Set isMemberOf, InstallationLogger installLog) throws RepositoryException,
AuthorizableCreatorException {
Set authorizableSet = new HashSet();
@@ -733,13 +758,13 @@ Set validateAssignedGroups(
// check if authorizable is contained in any of the
// configurations
- AuthorizableConfigBean configBeanForIsMemberOf = installLog.getAcConfiguration().getAuthorizablesConfig()
+ AuthorizableConfigBean configBeanForIsMemberOf = authorizablesConfig
.getAuthorizableConfig(memberOfAuthorizable);
if (configBeanForIsMemberOf != null) {
- Group newGroup = (Group) createNewGroup(userManager, configBeanForIsMemberOf, installLog, session);
+ Group newGroup = (Group) createNewGroup(userManager, authorizablesConfig, configBeanForIsMemberOf, installLog, session);
authorizableSet.add(newGroup.getID());
LOG.info("Created group to be able to add {} to group {} ", authorizablelId, memberOfAuthorizable);
diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/impl/ExternalGroupInstallerServiceImpl.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/impl/ExternalGroupInstallerServiceImpl.java
index 1286ec8f..195d5d04 100644
--- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/impl/ExternalGroupInstallerServiceImpl.java
+++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/impl/ExternalGroupInstallerServiceImpl.java
@@ -33,6 +33,7 @@
import biz.netcentric.cq.tools.actool.authorizableinstaller.AuthorizableCreatorException;
import biz.netcentric.cq.tools.actool.configmodel.AuthorizableConfigBean;
import biz.netcentric.cq.tools.actool.helper.Constants;
+import biz.netcentric.cq.tools.actool.history.InstallationLogger;
import biz.netcentric.cq.tools.actool.installationhistory.AcInstallationHistoryPojo;
/** SCR component to create external groups (as configured using "externalId"). Only available if package
@@ -50,7 +51,7 @@ public class ExternalGroupInstallerServiceImpl {
public Authorizable createGroupWithExternalId(
final UserManager userManager,
final AuthorizableConfigBean authorizableConfigBean,
- AcInstallationHistoryPojo status,
+ InstallationLogger status,
Session session)
throws AuthorizableExistsException, RepositoryException,
AuthorizableCreatorException {
diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/ConfigurationMerger.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/ConfigurationMerger.java
index 56a23ecb..0f80f9bc 100644
--- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/ConfigurationMerger.java
+++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/ConfigurationMerger.java
@@ -14,7 +14,7 @@
import javax.jcr.Session;
import biz.netcentric.cq.tools.actool.configmodel.AcConfiguration;
-import biz.netcentric.cq.tools.actool.history.AcInstallationLog;
+import biz.netcentric.cq.tools.actool.history.PersistableInstallationLogger;
import biz.netcentric.cq.tools.actool.validators.exceptions.AcConfigBeanValidationException;
public interface ConfigurationMerger {
@@ -31,7 +31,7 @@ public interface ConfigurationMerger {
* @throws AcConfigBeanValidationException in case the given configuration is invalid */
public abstract AcConfiguration getMergedConfigurations(
final Map newestConfigurations,
- final AcInstallationLog installationLog,
+ final PersistableInstallationLogger installationLog,
final ConfigReader configReader, Session session) throws RepositoryException,
AcConfigBeanValidationException;
diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlConfigurationMerger.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlConfigurationMerger.java
index c714e5ec..ee180763 100644
--- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlConfigurationMerger.java
+++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlConfigurationMerger.java
@@ -8,7 +8,7 @@
*/
package biz.netcentric.cq.tools.actool.configreader;
-import static biz.netcentric.cq.tools.actool.history.AcInstallationLog.msHumanReadable;
+import static biz.netcentric.cq.tools.actool.history.PersistableInstallationLogger.msHumanReadable;
import java.util.ArrayList;
import java.util.Arrays;
@@ -38,7 +38,8 @@
import biz.netcentric.cq.tools.actool.configmodel.AuthorizablesConfig;
import biz.netcentric.cq.tools.actool.configmodel.GlobalConfiguration;
import biz.netcentric.cq.tools.actool.helper.Constants;
-import biz.netcentric.cq.tools.actool.history.AcInstallationLog;
+import biz.netcentric.cq.tools.actool.history.PersistableInstallationLogger;
+import biz.netcentric.cq.tools.actool.history.InstallationLogger;
import biz.netcentric.cq.tools.actool.validators.AceBeanValidator;
import biz.netcentric.cq.tools.actool.validators.AuthorizableValidator;
import biz.netcentric.cq.tools.actool.validators.ConfigurationsValidator;
@@ -64,7 +65,7 @@ public class YamlConfigurationMerger implements ConfigurationMerger {
@Override
public AcConfiguration getMergedConfigurations(
final Map configFileContentByFilename,
- final AcInstallationLog history,
+ final PersistableInstallationLogger history,
final ConfigReader configReader, Session session) throws RepositoryException,
AcConfigBeanValidationException {
@@ -179,7 +180,7 @@ public AcConfiguration getMergedConfigurations(
}
void ensureIsMemberOfIsUsedWherePossible(AuthorizablesConfig mergedAuthorizablesBeansfromConfig,
- AcInstallationLog history) {
+ InstallationLogger history) {
for (AuthorizableConfigBean group : mergedAuthorizablesBeansfromConfig) {
if (!group.isGroup()) {
diff --git a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroChildNodeObjectsProvider.java b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroChildNodeObjectsProvider.java
index b8fee58e..55f914ed 100644
--- a/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroChildNodeObjectsProvider.java
+++ b/accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroChildNodeObjectsProvider.java
@@ -12,13 +12,13 @@
import javax.jcr.Session;
-import biz.netcentric.cq.tools.actool.history.AcInstallationLog;
+import biz.netcentric.cq.tools.actool.history.InstallationLogger;
/** Provides the objects for .
*
* @author ghenzler */
public interface YamlMacroChildNodeObjectsProvider {
- List
+
+ com.adobe.granite
+ com.adobe.granite.crypto
+ 3.0.0
+ provided
+
org.osgi
org.osgi.core