HOME DOCUMENTATION DOWNLOADS BLOG

XPath row level security rule on child entity based on master entity column value

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Hi,
is there a way to access parent attribute value in child entity without lookup in row level security XPath rule?
Example:
Parent Entity E1 with columns E1C1(Id) and E1C2 and child Entity E2 with columns E2C1(refE1C1Id) and E2C2. Now I have simple screen based on datastructure with E1 as parent and E2 as child. I need row level security rule on E2, which will decide if add row on child screen is allowed based on value in column E1C2 from master Entity E1.

Thank you.
Ivan

Row-level security rules have no way to access data outside the row.

But it is possible to modify the data structure in a way that it provides the parent attribute in the child record.

  • Add a field to a child data structure entity
  • Select a parent entity in the Entity attribute
  • Select the field you need

Now the parent field will be available in the child entity for rule evaluation.

Thank you.
Is there any performance impact when datastructure is modified that way? For instance - it adds one more SQL select to each child row to get the parent value or only one more SQL select for whole child entity?

If the data structure is already in the form of master-detail and you include this then it only adds the field in-memory. No special database queries will be fired.