Skip to content

Instantly share code, notes, and snippets.

@immilev
immilev / JcrQueryLibrary.md
Created June 11, 2025 10:29 — forked from floriankraft/JcrQueryLibrary.md
Some useful JCR queries (XPATH, SQL2) for AEM/CQ development.

SQL2

All nodes with a specific name

SELECT * FROM [nt:unstructured] AS node
WHERE ISDESCENDANTNODE(node, "/search/in/path")
AND NAME() = "nodeName"

All pages below content path

Use Case:
A number of users (ex. www-data, ivailom, etc) need to access a directory (ex. /var/www/media) securely.
Steps:
1. Create a new group that would govern the group access to the directory.
sudo groupadd varwwwmedia
NOTE: Using the default group of the user that created the directory may have unintended consequences elsewhere
2. Add the user that needs access to the group.