Documentation

Learn how to create databases and use the REST API.

Visit the blog for in-depth articles and tutorials.

Join our FB group to interact with the restdb.io team and active users.


Users and Roles

restdb.io supports role based access control. Roles are particularly useful when you need to restrict access to what users can see and do in the data manager in your database. In Developer mode, click the Access column of the Collection you want to restrict. In the screenshot below, we have added 'read'-access (GET in HTTP speak) to the 'editor' and 'interns' role, and Create/Update/Delete-access to the 'editor' role only. Users without these roles will not be able to see anything.

roles

It's important to understand that the roles that you assign in the data manager are abstract. The actual connection between a user and its roles are set in the Settings of your database. In your database settings, you simply need to assign the proper roles to each user.

roles-admin

Externally authenticated users (Authentication documentation) can also be restricted with roles and access rules. A user in the User collection must have an array with the required roles, e.g.:

{
    "_id": "57cee0f9a72afb7d20001ff", 
    "email": "jane@corp.com",
    "email_verified": true, 
    "name": "Jane Smith",
    "given_name": "Jane",
    "family_name": "Smith",
    "picture": "https://lh4.googleusercontent.com/xxx/photo.jpg",
    "gender": "female",
    "locale": "en",
    "roles": ["gamer", "leader"]

Private data

You can check the "Enable private data" option on the Access dialog for a particular Collection.

private-option

This is important if you want to prevent Users to see data from each other. Administrators can always see all data by clicking on the Show all icon in the data list view.

private-data

The private data option will filter data on API access for externally authenticated users (Authentication documentation).