Users and Groups
To create a user, navigate to the Users and Groups view via the main menu and click on Add User.
A new user will be created with a random default name. You can now rename the user.
First lookup the admin user (or any other user you like to change the password for):
$ curl -HX-User:admin -HX-Password:admin http://<hostname>:<port>/structr/rest/users?name=admin
{
"query_time": "0.002282709",
"result_count": 1,
"result": [
{
"type": "User",
"name": "admin",
"salutation": null,
"firstName": null,
"middleNameOrInitial": null,
"lastName": null,
"id": "f02e59a47dc9492da3e6cb7fb6b3ac25"
}],
"serialization_time": "0.000288091"
}
Then issue a PUT request on the object, using the UUID of the user as reference.
In Structr, all database objects have a unique ID (random version 4 UUID without hyphens).
$ curl -i -HX-User:admin -HX-Password:admin -XPUT
http://<hostname>:<port>/structr/rest/users/f02e59a47dc9492da3e6cb7fb6b3ac25
-d '{"password":"secret"}'
HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=1vld2piha8che7mhlo1lt0agr;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 0
Server: Jetty(9.1.3.v20140225)
If we issue the GET request from above again, using the old credentials admin/admin, we see that we’re not able see the user data anymore.
$ curl -i -HX-User:admin -HX-Password:admin http://<hostname>:<port>/structr/rest/users?name=admin
HTTP/1.1 401 Unauthorized
Set-Cookie: JSESSIONID=1mebd77ksm9v2dwgxyc3r6tua;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Length: 133
Server: Jetty(9.1.3.v20140225)
{
"code": 401,
"message": "Wrong username or password, or user is blocked. Check caps lock. Note: Username is case sensitive!"
}
Using the new password, it works:
$ curl -i -HX-User:admin -HX-Password:secret http://<hostname>:<port>/structr/rest/users?name=admin
HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=wecd8ce161qb1m06g6v1c2r1j;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json; charset=utf-8
Vary: Accept-Encoding, User-Agent
Transfer-Encoding: chunked
Server: Jetty(9.1.3.v20140225)
{
"query_time": "0.002020017",
"result_count": 1,
"result": [
{
"type": "User",
"name": "admin",
"salutation": null,
"firstName": null,
"middleNameOrInitial": null,
"lastName": null,
"id": "f02e59a47dc9492da3e6cb7fb6b3ac25"
}],
"serialization_time": "0.000170156"
}
To set the password of a user, navigate to the Users and Groups view and hover over the user you want to change the password for.
Click on the properties icon ().
In the Edit Properties dialog, activate the Node Properties tab, scroll to the line with the Password key and enter the new password into the value field.
Please Note: While you’re typing, you can see the new password you’re entering. The existing password will never be displayed. Structr does not store cleartext passwords but only a hash value. The hash value also is never being displayed in the UI.
To create a group, navigate to the Users and Groups view via the main menu and click on Add Group.
A new group will be created with a random default name. You can now rename the group.
To add a user to a group, simply drag and drop the user element onto the desired group element.
Access rights granted to a group are inherited to all users in this group.
Structr provides built-in management of users and groups. Creating users and groups is as simple as clicking on the respective buttons and renaming the new object by clicking on the name and hit enter or tab after chaging it.
To allow a user to login, you need to set a password.
A user can be added to a group by dragging the user element and dropping it onto the desired group.