Listing User IDs
Introduction
There are rare situations like when using shell commands that require the user ID as parameter. This page shows how to get it. As an example of a use case, see the Manually Trigger Re-Indexing Spaces.
-
Via the web UI
Currently, there is no option to get a user ID via the web UI. -
Via CLI
Administrators can query Infinite Scale via the graph API and get a users ID via shell commands using an authenticated curl GET command accessing the Infinite Scale API.The following prerequisites apply:
-
The administrator must have shell access where Infinite Scale runs.
-
The administrator needs to use the active bearer token in the request described below.
-
For ease of reading the result, the jq library should be installed on the OS where the shell command is executed. It is used in the examples.
Note that the life span of the bearer token is short, in particular less than a minute. If the token expires, the curl command will fail with an unauthorized message. So it is important to be prepared.
-
Via CLI
Explanation
Infinite Scale, except if not otherwise configured via the auth-basic service, does not accept basic authentication for security reasons. Therefore, if using a curl command, one must login via the browser and get the short living bearer token via the developer view for further processing.
Preparation
-
Open a terminal window for shell access.
-
The assembled curl command from the editor will be used for final execution.
-
-
Prepare an editor.
The editor is used to assemble the command that is further copied to the console to get the final result.-
Open an editor of choice.
Paste the following on top of the editor:-
Replace
<your host[:port]>
with the URL:port of your Infinite Scale instance.
You can omit the port if default. -
Replace the
{username}
placeholder with the name of the user. -
The
{token}
placeholder will later be replaced by the real bearer token you get from the browser. -
Note to add a trailing blank line in the example as content is copied afterwards.
curl -vk \ 'https://<your host:9200>/graph/v1.0/users/{username}' \ -H 'accept: application/json' \ -H 'authorization: Bearer {token}' \ | jq '.'
Omit
-v (add verbosity)
or-k (skip certificate verification)
if not needed.
-
-
-
Open a browser
-
Login as administrator at
https://<your host:9200>
-
Replace
<your host:9200>
with the URL:port of the Infinite Scale instance. -
Use the files view as starting point.
-
-
Open the browsers Developer Console
In Firefox: -
Open the Network tab.
-
Select XHR, browser dependent, it is maybe called Fetch XHR.
-
Reload the page to get updated content for XHR
-
In the column where you see
Name
,Status
,Type
, … check thatMethod
is present.
If not, right click on one column item and select Method to make it visible. -
Click on Method to sort, a
PROPFIND
line should be the first entry.
-
Get User IDs
Command Preparation
-
Reload the screen in the browser to get an updated bearer token.
-
Right click on the line containing PROPFIND and select
. -
Paste the copied result into the editor under the blank line, this may now look like this, the bearer is shortened in the example for ease of readbility.
-
Note that only the header authorization line in the response is of interrest.
curl -vk \ 'https://<your host:9200>/graph/v1.0/users/{username}' \ -H 'accept: application/json' \ -H 'authorization: Bearer {token} \ | jq '.' curl 'https://<your host:9200>/remote.php/dav/spaces/59ee3b90-3231-4621-81aa-4531d33e7671%24fb9e2625-cdb0-4f21-8a34-db775a976707' \ -X 'PROPFIND' \ -H 'accept: */*' \ -H 'accept-Language: en' \ -H 'authorization: Bearer eyJhb ... C1wUs' \ -H 'Connection: keep-alive' \ ...
-
-
Copy the complete line:
-H 'Authorization: Bearer eyJhb ... C1wUs' \
-
Replace the authorisation line on top containing the prepared command with the copied content.
-
You now have a full curl command including an active bearer token for authentication that is used in the next step.
Command Execution
-
Copy the full curl command from the top and paste it into the prepared shell.
You should get prettyfied json strings printed. -
If you get no output or, when using verbosity an output on top contaning:
Closing connection
, the bearer token has expired and needs to be refreshed for authentication. To do so, start again with Command Preparation.
Output Interpretation and Usage
-
The ID identifying the user is under
givenName
namedid
like:"id": "4c510ada-c86b-4815-8820-42cdf82c3d51",
-
Copy the ID
-
excluding the surrounding double quotes and
-
embed it in single quotes for any tasks that require a space ID as parameter.
-
Example:
"4c510ada-…-42cdf82c3d51"
→'4c510ada-…-42cdf82c3d51'
Single quotes are necessary because the ID can contain a
$
sign which is a special character for the shell. -