Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

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

bsr78033597
Level 2
Level 2

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
1 Accepted Solution
Nupur_Jain
Correct answer by
Community Advisor
Community Advisor

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

View solution in original post

2 Replies
Nupur_Jain
Correct answer by
Community Advisor
Community Advisor

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

View solution in original post

Arun_Patidar
Community Advisor
Community Advisor

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":{}}