curl command to fetch user path in JCR by Login id ?

bsr78033597

23-07-2020

Hi, is there a curl command to fetch a User's JCR path by Login Id? The curl command to change a user's password requires his JCR path (e.g. below), so I'm thinking to fetch user's JCR path by Id, in the prior step. Please suggest other alternate approach, if any.

 

e.g. curl -u testuser:OLD_PWD -F rep:password=”NEW_PWD” http://localhost:4502/home/users/t/testuser.rw.html

 

Thanks.

curl User Management

Accepted Solutions (1)

Accepted Solutions (1)

Nupur_Jain

MVP

23-07-2020

Hi @bsr78033597 

 

You can use Query builder path query to access user path by login ID. Find the example below

 

curl -u admin:admin "http://localhost:4502/bin/querybuilder.json?path=/home/users&property=rep:authorizableId&property.value=admin"

 

The query will return data in json format like 

 

{
"success": true,
"results": 1,
"total": 1,
"more": false,
"offset": 0,
"hits": [
{
"path": "/home/users/f/fKws0F07AYaqkqiiKTQs",
"excerpt": "",
"name": "fKws0F07AYaqkqiiKTQs",
"title": "fKws0F07AYaqkqiiKTQs",
"created": "2020-03-26 13:15:40"
}
]
}

 

Hope it helps!

Thanks!

Nupur

Answers (1)

Answers (1)

Arun_Patidar

MVP

24-07-2020

User info is exposed by /libs/cq/security/userinfo.json

e.g.
{"userID":"anonymous","userName":"anonymous","userName_xss":"anonymous","home":"/home/users/a/anonymous","impersonated":false,"allowedApps":[],"preferences":{}}