Forum Discussion
Anonymous
3 years agoNot applicable
Row Level Security conditions for two tables
Hi All,
I need a help to implement row level security for two tables. Please find below tables and their relationship mapping:
Table 'Country':
| Country Short Code | Country Long Name |
| AU | Australia |
| SGBN | Singapore |
| MY | Malaysia |
Table 'Entity':
| Country Long Name | Entity ID |
| Malaysia | MY13SP1 |
| Malaysia | MY13SP2 |
| Singapore | SG13SP3 |
| Australia | AU13SP4 |
Table 'List':
| Entity ID | List 1 | List 2 |
| MY13SP1 | Y | N |
| MY13SP2 | N | N |
| SG13SP3 | Y | Y |
| AU13SP4 | N | N |
Table 'User and Country':
| User ID | Country |
| abc email ID | Malaysia |
Table 'User and List':
| User ID | List 1 | List 2 |
| abc Email ID | Y | N |
The relationship mapping is as below:
1. Table Country (Country Long Name) mapped to Table Entity (Country Long Name)
2. Table Entity (Entity ID) mapped to Table List (Entity ID)
The RLS should work in such a way that when a ABC logins, he should be able to see all entities mapped to Malaysia (or) all entities mapped to List 1. Please find the list of entities ABC should be able to see:
| Entity ID |
| MY13SP1 |
| MY13SP2 |
| SG13SP3 |
Please let me know how we can implement the RLS to achieve this function. Thank you
No Replies