Information
This article describes how to list users in OX (Open-Xchange) in UCS-5.
Steps
- First install the JSON commandline processor "jq"
apt install jq
- Now you can list OX users with
/opt/open-xchange/sbin/listuser -c 10 -A oxadmin -P $(jq -r '."10".adminpass' /var/lib/univention-appcenter/apps/ox-connector/data/secrets/contexts.json)
- If you want to list users from a specific context, adjust the parameters accordingly
/opt/open-xchange/sbin/listuser -c 14 -A oxadmin-context14 -P $(jq -r '."14".adminpass' /var/lib/univention-appcenter/apps/ox-connector/data/secrets/contexts.json)
As you can see the file contexts.json gets used here.
We can further automate/simplify the process by using the following script to list users from a specific context:
#!/usr/bin/env bash
secretsfile=/var/lib/univention-appcenter/apps/ox-connector/data/secrets/contexts.json
contextadmin=$(jq --arg context $2 -r '.[$context]."adminuser"' $secretsfile)
contextadminpass=$(jq --arg context $2 -r '.[$context]."adminpass"' $secretsfile)
echo
/opt/open-xchange/sbin/$1 -c $2 -A $contextadmin -P $contextadminpass $3 $4 $5 $6 $7 $8
echo
You can use the script as follows:
$ /path/to/script.sh listuser 20
Id Name Displayname Email qmax qused
2 oxadmin-context20 OX Admin oxadmin-context20@dom.ain -1
For older versions of OX take a look here: