Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

hierachy and row security

Hi Experts,

 

i have a hierachy table - called hierachy as follows:

 

child_id , email, parent_id, path

1   ,  [email protected] , 2 ,     2|1 

2    ,  [email protected] ,    ,     2 

3   ,   [email protected] ,   ,      3 

 

If I would to set row based security 

i would like the  [email protected] user can see all 3 records because: 

1. he is the parent of the child_id 1 

2. his own record - child _id 2 

3. his own record - child_id 3 

 

PATHCONTAINS(path, maxx(hierachy , email =  [email protected]), child_id)) or PATHCONTAINS(path, minx(hierachy , email =  [email protected]), child_id)) 

this would work if each email only has 2 ids. 

However, if i have undefined number of id for each email. 

Is there a best practice to resolve this issue?