Skip to content

Allow incremental update #155

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ghenzler opened this issue Mar 1, 2017 · 6 comments
Closed

Allow incremental update #155

ghenzler opened this issue Mar 1, 2017 · 6 comments
Assignees
Milestone

Comments

@ghenzler
Copy link
Member

ghenzler commented Mar 1, 2017

For large instances, applying the AC Tool configuration can take three hours and longer (scales with the amount of content or no of paths) due to the fact that all ACEs are deleted and reapplied to the content paths.

It would be good to compare for each path the configuration with the actual ACL. The work from #127 has made this easier (now only ACEs for authorizables in config outside of "configuration path space" are deleted up front, changes to the ACL of a certain path are made as a conceptional unit).

The biggest challgenge is the use of the AEM CqActions class that operates via an algorithm onto the ACL, hence it is not just comparing the privileges list from config with the privileges on the actual path.

@ghenzler ghenzler added this to the 2.0.0 milestone Mar 1, 2017
@ghenzler ghenzler self-assigned this Mar 1, 2017
@ghenzler ghenzler changed the title Allow incremental updates to permissions instances Allow incremental update Mar 1, 2017
@ghenzler
Copy link
Member Author

ghenzler commented Mar 6, 2017

There are two options to achieve incremental update of the ACL of one path (simple compare of configured ACL with existing ACL does not work due to CqActions):

Option 1:

While installing the ACLs to the paths, have a second "test session" running a long that the ACL is applied to before saving it to the actual session. The "test session" would never be saved and refresh(false) (reverting the session) would be called after testing each path (to not grow a large change set). After applying the ACL for a path to the "test session", the resulting privileges could be compared to what the actual session has, if it is not the same the ACL is applied to the actual session and saved, otherwise the path can be skipped for the actual session. (NOTE: hasPendingChanges() can not be used because the current algorithm removes and adds the entries, this will be recorded as pending changes even if the ACEs are the same).

CON: Parallel sessions might not be considered good practice (see #146 that came indirectly from Adobe), however for this use case (and using the refresh() after every path is should be fine)
CON: No improvement to #48
PRO: Fairly simple to implement, no change of behaviour.

Option 2:

For every path and each AuthorizableConfigBean, use a fake authorizable to see what CqActions would create (use a fake authorizable to ensure no automatic merging by CqActions is done). This creates a mapping between an actions set to the resulting privileges at the very path (resulting privileges are dependent on the path and particularly if there is a jcr:content sub node). Remove the fake authorizable from the ACL after the mapping is produced.

After having a mapping from actions to privileges, the existing ACL can be easily be compared to the configured permissions.

Pro: This would solve #48 (as the automated merging in CqActions is cricumvented)
Con: Potentially the resulting ACL becomes longer if using actions (however tuning is always possible when using privileges directly).
Con: Maybe we are not 100% backwards compatible (although in theory the resulting behaviour should be exactly the same, also delivering this with 2.0.0 should make it clear that behaviour can slightly change)

@ghenzler
Copy link
Member Author

ghenzler commented Mar 9, 2017

Introduced a global_config flag that allows to switch between incremental and "classic" installation (default is incremental):

- global_config:
    installAclsIncrementally: true

By running the classic way first and then the incremental way on top it is really easy to test if the new incremental approach does not introduce any changes: "No changes were made to ACLs (session has no pending changes)" is printed in the result then.

ghenzler added a commit that referenced this issue Mar 29, 2017
Conflicts:
	accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/helper/AcHelper.java
ghenzler added a commit that referenced this issue Mar 29, 2017
Conflicts:
	accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlConfigurationMerger.java
ghenzler added a commit that referenced this issue Mar 29, 2017
Conflicts:
	accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/acls/AceBeanInstallerImpl.java
	accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/helper/AccessControlUtils.java
ghenzler added a commit that referenced this issue Mar 29, 2017
ghenzler added a commit that referenced this issue Mar 29, 2017
@ghenzler
Copy link
Member Author

Implemented Option 2 from #155 (comment)

@chetanyajain
Copy link

Can we update documentation section to add the global_config for installAclsIncrementally?

@ghenzler
Copy link
Member Author

installAclsIncrementally is undocumented because it was only used for testing the 2.0.0 release (for quickly switching between the 1.x and 2.x way). Today it is still in but the plan is to remove it soon completely.

@chetanyajain Do you have a reason to not install ACLs incrementally? (incremental install is the default for 2.x)

kwin added a commit that referenced this issue Jun 10, 2024
Document `installAclsIncrementally` because sometimes useful in the context of external syncing

Relates to #155
@kwin
Copy link
Member

kwin commented Jun 10, 2024

Documented now with 5654dd4 as useful for external sync sometimes.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants