Setting a constraint on a data grid based on a user object

0
Hello dear reader, This is my first post so bear with me :-) I'm building an app with several user roles, one of which is "EM" (Event Manager). The app users have a user role, a usermanagement/user object and they CAN be associated with an establishment object. Establishments have Event objects attached to them. EM users have userrole specific pages. One of those pages has a data grid which shows events. Is there a way to make the data grid show events specific to a user's establishment if the user is associated with an establishment? Besides only showing specific events i'd like to constrain new and edit pages to a users establishment as well but i think i can just copy the constraint once i know how it works. Basically i want "If current user is associated with establishment, show events associated with establishment, else show all events". Is there an xpath to do this or do i need to keep a variable HasEstablishment? If i need to clarify more, please let me know. Domain model is as follows: Thanks
asked
1 answers
1

Hello Tom,

I would suggest holding a HasEstablishment boolean and rendering the grid accordingly, I believe having two grids in this case and only rendering one should work.

As for the restriction I suggest using the default "New", "Edit" and "Delete" buttons and use entity access to limit what users can do. You can further use the "HasEstablisment" boolean to hide/show any buttons if needed.

Also, if you need help for your Events per establishment grid's xpath, it should be something like "Event_Establishment/Establishment/User_Establishment = [%currentUser%]"

Hope this helps

answered