Setting up user roles

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsSetting up user roles
      1. Tutorial

Set up a user role.

      1. Background

Roles govern HTTP access to the REST API endpoints in DreamFactory. When an end user authenticates and receives a JWT token, her role determines what API endpoints she can access.

Roles tie together end users, applications, and services (REST API endpoints) in DreamFactory. More specifically, end users are associated with roles, and roles are associated with both applications and services (REST API endpoints). This data model grants explicit end user access to services in the context of specific applications.

Applications in DreamFactory can have multiple roles. For example, your application might have different classes of users (i.e. user roles) with different API permissions. Applications can also have a default role, which specifies public API access. For example, you might expose some API endpoints without requiring any authentication.

Likewise, end users can have multiple roles. For example, end user John Doe might have different API permissions for different applications.

      1. API Endpoint
GET https://{url}/api/v2/{api_name}/_table/{table_name}?filter={filter_string}
      1. API Docs Screenshot

Swagger-filter.png

      1. Example - GET contact records whose last name starts with 'Y'
  • Table name: contact
  • Filter parameter in API call:
    last_name like Y%
  • Request URL:
    https://foo.com/api/v2/db/_table/contact?filter=last_name%20like%20Y%25
      1. Example - GET contact records whose last name is 'Yang'
  • Table name: contact
  • Filter parameter in API call:
    last_name = Yang
  • Request URL:
    https://foo.com/api/v2/db/_table/contact?filter=last_name%20%3D%20Yang
      1. Example - GET contact records whose first name is 'Jon' and last name is 'Yang'
  • Table name: contact
  • Filter parameter in API call:
    first_name = Jon and last_name = Yang
  • Request URL:
    https://foo.com/api/v2/db/_table/contact?filter=first_name%20%3D%20Jon%20and%20last_name%20%3D%20Yang
      1. Example - GET contact records whose first name starts with 'J' and last name starts with 'Y'
  • Table name: contact
  • Filter parameter in API call:
    first_name like J% and last_name like Y%
  • Request URL:
    https://foo.com/api/v2/db/_table/contact?filter=first_name%20like%20J%25%20and%20last_name%20like%20Y%25
      1. Example - GET contact records whose Twitter handle contains 'jon' or whose Skype handle contains 'jon'
  • Table name: contact
  • Filter parameter in API call:
    twitter like %jon% or skype like %jon%
  • Request URL:
    https://foo.com/api/v2/db/_table/contact?filter=twitter%20like%20%25jon%25%20or%20skype%20like%20%25jon%25