3XX - User management

300 - User authentication

Tries to authenticate the provided data.user with the data.password into the system. If the user/password combination is correct, returns an "OK" data.status ("KO" if not) and the data.user, data.displayName and data.roles of the logged user. The server will save the logged user into the connection session, so the next codes that requires authentication will work without providing user or token.

In

{"type":300,"data":{"user":"user","password":"password"}}

Out

{"type":300,"data":{"status":"OK","user":"user","displayName":"user","roles":["admin"]}}

301 - User registration

Tries to register an user with the provided data.user, data.password and data.email. If the insertion is correct, returns an "OK" as data.status. If the same user exists, or the data doesn't meet the requirements (username or password length), an "KO" data.status is returned. The first registered user will gain administrator privileges by default.

In

//

Out

//

302 - User data edit

Updates the user data. Only data.displayName, data.password and data.email could be changed. Only a user can update its data by being authenticated and providing data.password. An administrator can change the data of any user without providing the data.password. Requieres authentication or administration privileges.

In

//

Out

310 - Users list

Returns the users list filtered by name (data.filter), you can left it as empty string if you don't want to filter. The results are paginated, so a number page (data.page) and a number of elements per page (data.pageSize) should be specified. Requieres authentication.

In

Out

320 - Roles list

Returns the roles list.

In

Out

321 - Role creation

Creates a new role with the provided data.name and data.description. If data.remove is provided and set to true, removes it. Requires administration privileges.

In

Out

322 - Role assignation

Adds the role (data.name) to a user (data.user). Requires administration privileges.

In

Out

330 - Groups list

Returns the groups list filtered by name (data.filter), you can left it as empty string if you don't want to filter. The results are paginated, so a number page (data.page) and a number of elements per page (data.pageSize) should be specified. Requires authentication.

In

Out

331 - Group creation

Creates a group with the provided data.name and data.description. The user who sends this command will be added to the group as owner and as member. If a group with the same name exists and the command is sent by the owner or an admin, it will be edited to allow description changes. Requires authentication.

In

Out

332 - Group assignation

Add a data.user to a data.group. Only the owner of the group is allowed to do it. Requires authentication.

In

Out

333 - User groups

Returns the list of groups that the data.user is member. Requires authentication.

In

Out

340 - Public key/value storage query

Queries the provided data.key from the public key/value storage (anyone can read from it).

In

Out

341 - Public key/value storage upsert

Makes an upsert (insert or update) into the public key/value storage (anyone can upsert).

In

Out

Last updated

Was this helpful?