Users and Groups

Users and Groups Overview

Each aidbox box has its own users and security rules. You can use REST API, Box Admin UI or aidbox-cli to manage users in an aidbox box. Also you can enable registration module to allow users register in an aidbox box by themselves.

Users could be assigned to groups and for each group you can create specific security rules.

Users and Groups tools are used to create, edit and delete box users and user groups. These users' credentials are used to log in the application working on the top of the aidbox box.

Back To Top

Users and Groups UI Guide

How to add a new group

  1. Open the Groups tab
  2. Click the 'Create new item' button clojure.lang.LazySeq@6cb560ac
  3. Fill in the fields Name and Description
  4. Click the Create button clojure.lang.LazySeq@6cb5d493

Back To Top

How to add a new user

  1. Open the Users tab
  2. Click the 'Create new item' button clojure.lang.LazySeq@6cc21b0d
  3. Fill in the fields Email, Password, Data (any valid JSON), select Group-ids (if there are groups)
  4. Click the Create button clojure.lang.LazySeq@6cc28ed4

Back To Top

Search by users and groups

  1. To search by users and groups, simply enter the search text in the filter field. clojure.lang.LazySeq@6ccfbd96
  2. Records in the list will be immediately filtered according to your entry. clojure.lang.LazySeq@6ccfbd9c

Back To Top

How to edit users and groups

  1. Select required user or group record in the list
  2. Perform necessary editing
  3. Click the Save button clojure.lang.LazySeq@6cb5d4ea clojure.lang.LazySeq@6cc28f12 clojure.lang.LazySeq@6cb5d4ea clojure.lang.LazySeq@6cc28f12

Back To Top

How to delete users and groups

  1. Select required user or group record in the list
  2. Click the Delete button
  3. The record will be deleted without confirmation clojure.lang.LazySeq@6cb5d4ee clojure.lang.LazySeq@6cc28f15

Back To Top

Users and Groups CLI

User Commands

user is a command for working with users in current box. To view a list of all available subcommands, execute:

$ aidbox user help
  user list                -- Display a list of users in current box
  user help                -- Show help information
  user new                 -- Create a user via wizard
  user new email:password  -- Create a user inline

user list

Outputs a list of all users in current box.

$ aidbox user list
  INFO: Display a list of users in box [boxname]
  ; For now it displays raw JSON

user new

Creates a new user using a wizard, in current box.

$ aidbox user new
  INFO: Create new user in box [boxname]
  Email: <test@gmail.com>
  Password: <password>
  OK: User [test@gmail.com] has been successfully created in box [boxname]

Another command to create a user inline without a wizard, has the following syntax:

aidbox user new email:password

$ aidbox user new test_2@gmail.com:password
  INFO: Create new user in box [boxname]
  OK: User [test_2@gmail.com] has been successfully created in box [boxname]

Back To Top

Users and Groups REST API

Same tasks can be performed programmatically via REST API.

POST /users

Creates new user.

Example Request:

POST https://[box-name].aidbox.io/users?access_token=[access-token]
Accept: application/json
Content-Type: application/json

{"email": "user@example.com", "password": "godloveskittens", "data": "{}"}

Example Response:

{
  "data": null,
  "password": "$s0$f0801$PAPMyIhrU98utG2MFZN66w==$L6xOyD4seflK3hzQtQLAQJ6U1PP01x/ciDvSQnxfVIg=",
  "email": "user@example.com",
  "status": null,
  "id": 2
}
// HTTP/1.1 201 Created
// Server: nginx
// Date: Thu, 05 May 2016 10:38:44 GMT
// Content-Type: application/json
// Content-Length: 152
// Connection: keep-alive
// Request duration: 0.307818s

In case of invalid data you'll receive 422 Unprocessable Entity status:

{
  "entity": {
    "data": "{}",
    "password": "godloveskittens",
    "email": "user@example.com"
  },
  "errors": {
    "email": [
      "email is already taken"
    ]
  }
}
// HTTP/1.1 422 Unprocessable Entity
// Server: nginx
// Date: Thu, 05 May 2016 10:49:06 GMT
// Content-Type: application/json
// Content-Length: 126
// Connection: keep-alive
// Request duration: 0.514180s

GET /users

Returns list of existing box users.

Example Request:

GET https://[box-name].aidbox.io/users?access_token=[access-token]

Example Response:

[
  {
    "group-ids": [],
    "groups": null,
    "data": "{ }",
    "email": "user@example.com",
    "status": null,
    "id": 2
  }
]
// HTTP/1.1 200 OK
// Server: nginx
// Date: Thu, 05 May 2016 10:51:55 GMT
// Content-Type: application/json
// Content-Length: 180
// Connection: keep-alive
// Request duration: 0.403116s

GET /users/[id]

Retrieves data for specific user.

Example Request:

GET https://[box-name].aidbox.io/users/2?access_token=[access-token]

Example Response:

{
  "groups": [],
  "data": null,
  "password": "$s0$f0801$PAPMyIhrU98utG2MFZN66w==$L6xOyD4seflK3hzQtQLAQJ6U1PP01x/ciDvSQnxfVIg=",
  "email": "user@example.com",
  "status": null,
  "id": 2
}
// HTTP/1.1 200 OK
// Server: nginx
// Date: Thu, 05 May 2016 12:53:39 GMT
// Content-Type: application/json
// Content-Length: 164
// Connection: keep-alive
// Request duration: 0.192518s

PUT /users/[id]

Updates existing user.

Example Request:

PUT https://[box-name].aidbox.io/users/2?access_token=[access-token]
Accept: application/json
Content-Type: application/json

{"data": null, "password": "new-password", "email": "user@example.com"}

Example Response:

{
  "data": null,
  "password": "$s0$f0801$z7Q1dw22tyH5lkHTVSf0hQ==$NpBEXBOCbHty4cURu0FIm7rcSUCTXE3tHaPnE4fT5Ms=",
  "email": "user@example.com",
  "status": null,
  "id": 2
}
// HTTP/1.1 200 OK
// Server: nginx
// Date: Thu, 05 May 2016 13:06:19 GMT
// Content-Type: application/json
// Content-Length: 152
// Connection: keep-alive
// Request duration: 0.357732s

DELETE /users/[id]

Deletes specific user. Returns data of deleted user.

Example Request:

DELETE https://[box-name].aidbox.io/users/2?access_token=[access-token]

Example Response:

{
  "data": null,
  "password": "$s0$f0801$z7Q1dw22tyH5lkHTVSf0hQ==$NpBEXBOCbHty4cURu0FIm7rcSUCTXE3tHaPnE4fT5Ms=",
  "email": "user@example.com",
  "status": null,
  "id": 2
}
// HTTP/1.1 200 OK
// Server: nginx
// Date: Thu, 05 May 2016 13:07:35 GMT
// Content-Type: application/json
// Content-Length: 152
// Connection: keep-alive
// Request duration: 0.387985s

Back To Top