Accessing SQL tables

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsAccessing SQL tables
Line 5: Line 5:
 
### Background
 
### Background
  
Roles govern HTTP access to the REST API endpoints in DreamFactory. When you set up a SQL database, no tables are accessible by default (unless you are a DreamFactory Admin).
+
Roles govern HTTP access to the REST API endpoints in DreamFactory. When you set up a SQL database in the 'Services' tab, no tables are accessible by default (unless you are a DreamFactory Admin).
  
You can expose table access by [[DreamFactory/Tutorials/Setting up user roles|setting up user roles]].  
+
You can expose table access by [[DreamFactory/Tutorials/Setting up user roles|setting up user roles]] and granting access to specific SQL tables.  
  
an end user authenticates and receives a JWT token, her role determines which API endpoints she can access.
+
### Example - Grant SQL table access for a role.
 
+
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.
+
 
+
### Example - Create a new role in the DreamFactory admin console
+
  
 
1. Log into the DreamFactory admin console as an Admin.
 
1. Log into the DreamFactory admin console as an Admin.
 
2. Click on 'Roles' > 'Create'.
 
2. Click on 'Roles' > 'Create'.
3. Fill out role information, service access, and lookup keys (optional). Click to create the role. <br><br>
+
3. In the 'Access' tab, select your SQL database API for 'Service', the table for 'Component', HTTP verbs for  <br><br>
  
 
[[File:Create-role.png|1000px]]
 
[[File:Create-role.png|1000px]]

Revision as of 18:22, 23 October 2015

      1. Tutorial

Setting up role-based access to SQL tables

      1. Background

Roles govern HTTP access to the REST API endpoints in DreamFactory. When you set up a SQL database in the 'Services' tab, no tables are accessible by default (unless you are a DreamFactory Admin).

You can expose table access by setting up user roles and granting access to specific SQL tables.

      1. Example - Grant SQL table access for a role.

1. Log into the DreamFactory admin console as an Admin. 2. Click on 'Roles' > 'Create'. 3. In the 'Access' tab, select your SQL database API for 'Service', the table for 'Component', HTTP verbs for

Create-role.png

      1. Example - Create a new role with the REST API

You can operate on roles directly with the API. Click on API docs and view the 'System' API calls.

Swagger-role.png