Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Repository Initialization: Unable to create aem group with profile properties like givenName, email ..

Avatar

Level 2

I am unable to create group with profile properties using repository initialization

I am testing on AEM 6.5.11 instance

below repository initialization script:

create group repo_group

set properties on authorizable (repo_group)
set givenName to "Repo Group"
end

venkateshk87129_1-1648824626911.png

repo_group created but profile property givenName is not adding,

getting below error:

venkateshk87129_2-1648824804135.png

I am referring https://sling.apache.org/documentation/bundles/repository-initialization.html document.

could you please any one suggest me on this issue

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @venkateshk87129,

Your code will not work correctly on AEM 6.5.11 or even 6.5.12, because AEM is using old version of Apache Sling Repository Initializer which is 1.1.28. Base on following ticket SLING-10192, but also looking into implementation authorizable function is available from version 1.1.36.

You can check detailed differences on github:

Solution

  1. You can upgrade version of following 2 bundles: Apache Sling Repoinit JCR upgrade to version 1.1.36 and Apache Sling Repoinit Parser to version 1.6.10. After this your code will be working. You can also adjust your script a little bit because givenName is stored under profile node, so your script could look like this:
    create group repo_group
    set properties on authorizable (repo_group)/profile
        set givenName to "Repo Group"
    end
    Please contact Adobe before you will upgrade bundle version - to make sure it will not break anything. I did very quick test, and after manual upgrade all bundles were in Active state and AEM seems to work correct and stable. Nevertheless I did not made any extensive tests, so be very cerful if you decide to follow this option.
    Above change allows me to run the code successfully.
  2. Alternatively you can try to change your code a bit without upgrading the nodes. But I think it will be very difficult or even not possible. Set properties in version 1.1.28 supports paths - so instead authorizable (repo_group) you should give path to profile node. But because authorizable node name contains some uid it could be difficult to calculate it on your own upfront - you will need it to set proper path to profile node.
  3. You can also consider to use other tools for group creation like:
    1. AC Tool - https://github.com/Netcentric/accesscontroltool
    2. APM Tool - https://github.com/wttech/APM

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @venkateshk87129,

Your code will not work correctly on AEM 6.5.11 or even 6.5.12, because AEM is using old version of Apache Sling Repository Initializer which is 1.1.28. Base on following ticket SLING-10192, but also looking into implementation authorizable function is available from version 1.1.36.

You can check detailed differences on github:

Solution

  1. You can upgrade version of following 2 bundles: Apache Sling Repoinit JCR upgrade to version 1.1.36 and Apache Sling Repoinit Parser to version 1.6.10. After this your code will be working. You can also adjust your script a little bit because givenName is stored under profile node, so your script could look like this:
    create group repo_group
    set properties on authorizable (repo_group)/profile
        set givenName to "Repo Group"
    end
    Please contact Adobe before you will upgrade bundle version - to make sure it will not break anything. I did very quick test, and after manual upgrade all bundles were in Active state and AEM seems to work correct and stable. Nevertheless I did not made any extensive tests, so be very cerful if you decide to follow this option.
    Above change allows me to run the code successfully.
  2. Alternatively you can try to change your code a bit without upgrading the nodes. But I think it will be very difficult or even not possible. Set properties in version 1.1.28 supports paths - so instead authorizable (repo_group) you should give path to profile node. But because authorizable node name contains some uid it could be difficult to calculate it on your own upfront - you will need it to set proper path to profile node.
  3. You can also consider to use other tools for group creation like:
    1. AC Tool - https://github.com/Netcentric/accesscontroltool
    2. APM Tool - https://github.com/wttech/APM

Avatar

Level 2

thanks you Lukasz, its working , I think adobe preferable approach is repoinit , if we get any issue using repoinit we get help from adobe support team