Data Filtration - Practical use case with APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2023 03:53 PM - edited 12-13-2023 02:40 PM
Further to @Dan Martinez 's post on Data Filtration, I wanted to use the feature for integrations where we wanted to control what an integration should be able to read. Let’s first understand the requirement
There are 3 main API users; employee, vendor and partner
- Given user should be able to view only those records associated with it. For example,
- Vendor should be able to view only those records assigned to their group DFR Vendor
- An employee should be able to view only those records assigned to their group DFR Employee
- A partner should be able to view only those records assigned to their group DFR Partner
- Users with admin or ITIL role should be able to view all records from the table, including those assigned to Vendor, Employee and Partner
How I did it
I created a demo DF Requests table(u_df_request)with 3 fields – a DFR number(u_dfr_number), Description(u_description) and Assignment Group Name(u_group_name). In this example, we will use assignment group name to filter which records can be accessed in different scenario.
- Created sample records as given in the figure
To ensure that an API call from Vendor can retrieve only those records assigned to DFR Vendor group, we need to create two Data Filtration records for each scenario
1. To fetch the records that are assigned to DRF Vendor group, the API user should belong to DFR Vendor group or have ITIL roleThis means, to read the records that are assigned to DFR Vendor, the API user should be in the DFR Vendor group or have the ITIL role
2. To ensure that Vendor API user is unable to view anything other records, we need to create another data filtration record
This means, to read records which are NOT assigned to DFR Vendor, the API user should not be in DFR Vendor group. This prevents the Vendor API user from viewing records that are not assigned to DRF Vendor group
- Create the Data Filtration Records similar to above for Partner
- Create the Data Filtration Records similar to above for Employee
- Let's test now. First with the Vendor API User as per requirement #1a. As you can see, only two records are returned.
Let's now test with the ITIL user(Requirement #2). The ITIL user is able to view all the records on the table
Note : I have shown raw response format so as to view all records on one screenshot
I hope you find this post useful. Please share your feedback(if any) to make the content better
- 547 Views