Abstract
AEM Cloud Service Version : 2021.1.4738.20210107T143101Z-201217 (Jan 7, 2021)
Goal
Adding the following extension would restrict users from uploading duplicates files (files with same name). The check is done repository wide /content/dam
Solution
1) Create a service user configuration in repo init script ui.config\src\main\content\jcr_root\apps\eaem-cs-upload-unique-assets\osgiconfig\config.author\org.apache.sling.jcr.repoinit.RepositoryInitializer-eaem.config this is for querying and returning duplicates as JSON (in next steps).
scripts=[
"
create service user eaem-service-user with path system/cq:services/experience-aem
set principal ACL for eaem-service-user
allow jcr:read on /apps
allow jcr:read on /content/dam
end
"
]
2) Adding the above repo init script in code repo and installing on AEM CS creates a service user in /home/users/system/cq:services/experience-aem
3) Add the service user to bundle mapping in ui.config\src\main\content\jcr_root\apps\eaem-cs-upload-unique-assets\osgiconfig\config.author\org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-eaem.xml
Read Full Blog
Q&A
Please use this thread to ask the related questions.
Kautuk Sahni