# How to implement data access based on a table with user's permissions

**URL:** <https://community.dreamfactory.com/t/how-to-implement-data-access-based-on-a-table-with-users-permissions/490>\
**Category:** Authentication & Security\
**Created:** [October 22, 2014, 4:38pm UTC](https://community.dreamfactory.com/t/how-to-implement-data-access-based-on-a-table-with-users-permissions/490 "2014-10-22T16:38:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![benbusse](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/benbusse/32/4_2.png) [@benbusse](https://community.dreamfactory.com/u/benbusse)\
**Post date:** [October 23, 2014, 4:11pm UTC](https://community.dreamfactory.com/t/how-to-implement-data-access-based-on-a-table-with-users-permissions/490/2 "2014-10-23T16:11:19Z")

</div>

Here are a few pointers, let me know if this answers your questions:

> > And I wish to have two kind of users, an ordinary user and a manager.

You can set up two different roles in the Roles tab.

> > I would like to control the access to data depending if the user is associated to an object.

In the Roles tab, you can assign data permissions for each role in a few ways. First, you can specify CRUD permissions for each individual table. If your data model has a ‘top groups’ table and a ‘sub groups’ child table, then you can fetch top groups and related sub-groups in a single API call. You can also specify record-level permissions with server-side filters. For example, you can have an ‘owner’ field (user id) on ‘top groups’ and specify a filter that says ‘owner’ = {user\_id}. The server will enforce this rule so that only records created by the logged in user are returned in the query.

These blog posts and forum posts have more info:

> [@How would I manage (in the DSP), every user has his/her own Todo-List?](https://community.dreamfactory.com/t/how-would-i-manage-in-the-dsp-every-user-has-his-her-own-todo-list/181/2):
>
> (Somewhat) short answer: You’d add a field to the todo table which references the user id (the DSP will automatically store the user ID of the user creating the record). When your app makes a GET call to the todo table, you pass in the logged in user id as a filter parameter in the query to the todo table (you can get the user id from the /user api on login and store the id as a variable or make a method in your app that fetches the user id on demand at runtime). To ensure that other logged in…

> **[Data Segmentation with Server-Side Filtering and Lookup Keys - DreamFactory...](https://blog.dreamfactory.com/data-segmentation-with-server-side-filtering-and-lookup-keys/)**
>
> The 1.5 release of the DreamFactory Services Platform (DSP) introduces the ability to easily create server-side filters that control database access at the record level. Click here for an introduction to this feature, including how to restrict access...

> **[Demo – How to Make Relationship Queries with DreamFactory’s REST API -...](https://blog.dreamfactory.com/Demo-How-to-Make-Relationship-Queries-with-DreamFactory-s-REST-API/)**
>
> Developers often ask how to query related data with DreamFactory’s REST API. For example, how do you fetch a record and its related children as JSON in a single API call? In this post, we’ll demonstrate related data queries with a real example. Also...

> > Also, I’m developing an AngularJS page and accessing the dreamfactory using dreamfactory’s SDK.

You should also look at Michael’s user management module for Angular. This takes care of user registration and login. Also check out the data management directive he wrote.

> **[The Authenticated App With AngularJS + DreamFactory User Management -...](https://blog.dreamfactory.com/the-authenticated-app-with-angularjs-dreamfactory-user-management-module/)**
>
> This is part one of a three part tutorial. In this tutorial we will setup an AngularJS application on our local machine, install the DreamFactory AngularJS User Management Module, and connect to a DSP that lives on the DreamFactory Hosted System....

> **[Creating a Data Manager with AngularJS + DreamFactory - DreamFactory...](https://blog.dreamfactory.com/creating-a-data-manager-with-angularjs-dreamfactory/)**
>
> Many people need an app just to perform CRUD on data. Usually they resort to using one of the many Grid or Table plugins that exist such as JTables or ngGrid. I’ve found that while these are valid solutions they generally lack the ability to enforce...

---

_[View the full topic](https://community.dreamfactory.com/t/how-to-implement-data-access-based-on-a-table-with-users-permissions/490)._
