Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

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 CodeCountry Long Name
AUAustralia
SGBNSingapore
MYMalaysia

 

Table 'Entity':

Country Long NameEntity ID
MalaysiaMY13SP1
MalaysiaMY13SP2
SingaporeSG13SP3
AustraliaAU13SP4

 

Table 'List':

Entity IDList 1List 2
MY13SP1YN
MY13SP2NN
SG13SP3YY
AU13SP4NN

 

Table 'User and Country':

User IDCountry
abc email IDMalaysia

 

Table 'User and List':

User IDList 1List 2
abc Email IDYN

 

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