How to filter the list view for a specific user role?

0
Hello,   i am allmost finished with my application but i am wondering how filter the list view for a specific customer?  I created an application where you can book rooms. In the booking overview page the host/admin can see every booking on their system. I want the customers to be able to see the bookings that they created, so not the others. I already finished a registering/login system.   here is how to page looks like: https://ibb.co/517hpCw   i was checking this out to filter it for the customer role to set it to system.currentuser or somthing, but i cant find it anywhere: https://ibb.co/RYLMGck  
asked
2 answers
0

Hi Tim Schaeffer,

 

you can do it in a simpler way.

 

There is a concept called Access Rules in Domain Model. This can be seen only when your security is setup to Production.

 

 

Follow below steps to configure user-based data views:

1. Turn the security to Production.

2. Go to the entity you want to restrict.

3. Double click on it and go to Access Rule tab and create a new access rule.

4. select the module role which you restrict and give respective permissions (read and write)

5. Then go to the XPath Constraint tab and click on Owner button (before that click the checkbox of store Owner System variable).

6. Automatically the constraint will added to the constraint tab.

 

This can be done when security turned to production.

 

If not in production, you can constraint the data with adding constraint by selecting datasource as XPath

 

If you have any more queries, please check out this.

Security Rules

answered
0

Just answered this question:

https://community.mendix.com/link/space/community/questions/132861

 

Replace task by booking and you have set your data correctly.

 

Then you can set a XPath constraint on DATA level. thus in you security.

Add the constraint on the security rule for the customer 

 

[Booking_Customer/Customer/Customer_Account = '[%CurrentUser%]'] 

 

* Please note:

  1. The answer on task is for an automated list, you need to execute this for a SINGle Booking when you create a new booking for the customer. So no need for a loop and list commits.
  2. My written XPath is an example, it might be e bit different due to naming of entities and associations
answered