Privacy Rules: How to work around inability to test for intersection between lists?

Hi there

I have three relevant DataTypes: User, Team and Contract.

I’m trying set the Privacy Data Roles for the Contract DataType so that a particular Contract is only visible to a User who is a member of a Team associated with that Contract (for example, Jane is in the HR Team, the HR team can see “Tom’s Employment Contract”, so Jane can see that Contract) .

I’m having trouble because it doesn’t seem possible in the Privacy Data Roles’ “When” setting to test whether the Current User’s Team (list - e.g. “HR, Finance”) intersects with the Contract’s Team (list - e.g. “HR”). It only seems possible to see if one list contains a particular item:

I want to make sure I get the Privacy Rules 100% correct. Has anyone come across this issue? Any suggested workarounds?

Many thanks

Did you try intersect instead of contains?

Maybe this topic can help Issue with contains / intersect with list

Hi @Jici, thanks for the suggestion, but ‘Intersect’ isn’t available in that context. The only options are ‘contains’ or ‘doesn’t contain’:

I had come across the article you linked, but that has to do with filtering repeating groups, not with Privacy Data Roles.

There is no way to check if one element of a list IS IN another list.

Didnt know that it was not available there.

Same for a query such as Do a Search For, we can only check if an element IS IN a list, or if a list CONTAINS one single element. It’s a limit of Bubble right now.

The solution is to save before the search if your LIST intersect with the other List : first item is not empty.
If you compare your list against another dynamic one, then it’s difficult.


@Bubble, just wondering if that’s a known constraint? Is it something that could be updated in future?

Hi @emmanuel, I pinged the Bubble account, but it looks like you guys haven’t been online in that account for some time.

Is it worth me separately submitting a bug report / feature request for this?

To summarise the issue: If the condition is a single field, the rule can check whether X is “a string”, but if the condition is a list, the rules are currently unable to check whether Y contains “a string”.


This is on our list of things we’d like to add, but it’s not a simple project (has a lot of implication on the database side of things to ensure this works with good performance). So it’s on our list, but I unfortunately cannot give a timeline.


Hi @emmanuel, appreciate the update. Yes I’m sure it would be complicated. Good luck!

Hi @emmanuel ,

Still no update after 4 years on this. I guess this is a really difficult to implement but it’s really important to push to the next level.
Overall, managing list intersection in Bubble server side is almost impossible. Please, leverage the best researches on arrays and matrix mathematics, and secure that performing algorithm we all need :wink:

1 Like