Can I simplify these entity access rules?

Hi, I’m using access rules to limit the amount of data available to users of an offline tablet app. I have two entities, A and B. A has a start date attribute, and a 1-N relation to B. I first limit access to the A objects, by their date. So if the start date is ± 7 days from the current date, it will be accessible. Then, I want to only include the B entities, that are related to an A entity (relation != empty) that is also within that time window. Do I also have to add the ± 7 days rule in the B entity access rules (via the relation to A), or will it automatically apply, since I am already limiting access to A by that rule? Domain Model: A Access Rule: B Access Rule (simple version): B Access (complex version):
1 answers

Hi Nikolaus,

Entity Access is only applied to a certain entity. In your case, to make sure a user won't be able to see object of type B, you will also have to apply entity access to B.

Further I don't believe that the access rules you've shown above will work. You should see an Invalid Token Expression error.

To solve this I would advise to add a boolean attribute that controls the visibility. You can also use that in your access rules and keep the access rules simpel. You would have to use a scheduled event that periodically checks your data and flips the switch when needed.