Expand my Community achievements bar.

SOLVED

Programatically add permissions to system user in AEM 6.1

Avatar

Level 2

Hi,

is it possible to programmatically add permissions to a system user in AEM 6.1 (i.e. using java or maven)?

This is my use case: I want to manually create the system users and give them the needed permissions.

I tried to export the permissions stored in '/jcr:system/rep:permissionStore/crx.default/myuser' and then re-import, but I got an error saying that the path is protected (at least one other person had the same problem: http://stackoverflow.com/questions/31460105/how-to-import-content-with-system-user).

If I try to assign the permissions using java, then I have a chicken-egg problem: I need a service user with the right permissions to be able to assign the permissions. Or maybe there is a builtin system user that I could use for that?

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

Please have a look at the this Stackoverflow article, i hope this would answers your question.

Link:- http://stackoverflow.com/questions/24919675/cq5-aem-change-permissions-on-groups-with-curl

Setting permission

Send POST request with modifyAce selector and principalId parameter:

curl -u admin:admin -FprincipalId=content-authors -Fprivilege@jcr:read=denied \ http://localhost:4502/etc/tags/marketing.modifyAce.json

Removing permission

Send POST request with deleteAce selector and :applyTo parameter:

curl -u admin:admin -F:applyTo=content-authors \ http://localhost:4502/etc/tags/marketing.deleteAce.json

 

More Reference Link:-

Link:- http://stackoverflow.com/questions/31587635/how-to-give-user-permissions-programatically

Link:- https://gist.github.com/sergeimuller/2916697

 

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

1 Reply

Avatar

Correct answer by
Administrator

Hi 

Please have a look at the this Stackoverflow article, i hope this would answers your question.

Link:- http://stackoverflow.com/questions/24919675/cq5-aem-change-permissions-on-groups-with-curl

Setting permission

Send POST request with modifyAce selector and principalId parameter:

curl -u admin:admin -FprincipalId=content-authors -Fprivilege@jcr:read=denied \ http://localhost:4502/etc/tags/marketing.modifyAce.json

Removing permission

Send POST request with deleteAce selector and :applyTo parameter:

curl -u admin:admin -F:applyTo=content-authors \ http://localhost:4502/etc/tags/marketing.deleteAce.json

 

More Reference Link:-

Link:- http://stackoverflow.com/questions/31587635/how-to-give-user-permissions-programatically

Link:- https://gist.github.com/sergeimuller/2916697

 

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni