I want to show/hide/enable/disable fields on my forms based on current user role. I will implement standard RBAC patter for managing permissions and I will have list of all my form fields in database table + information who (role) can view/edit that field.
My question is, what is best way to implement solid mechanism on frontend to achieve this without adding any logic or conditions to my views. Im thinking of some way to encapsulate each UI component (textbox, datepicker, dropdown, etc.) to add permission processing in way that it will automatically pull user role from session and then set properties for that UI component.
Any ideas how to do this? Links to useful articles about how to do this correctly are welcome.
Thank you.