I have to implement resource based access control in React application. My requirement as below.
I have defined authorization control in database like below for each page elements like buttons, input fields, labels. and these authorization controls will get assigned to users during user registration.
PageName.userId.FieldName = 'Allow'
PageName.DeleteButton ='Not-Allow'
PageName.AddButton ='Allow'
PageName.DeleteButton ='Allow'
When user logged-in, then application must bring all user mapped authorization and check against the visiting page elements and then allow user to view those elements.
Example: User Listing page, there will be edit user, delete User and update user button. In this page, few user will have access to delete button and few users will not have access to delete button. Like this, I must apply authorization logic to input fields like user Id input field should not be visible to certain users during edit user action.
My Implementation would be on each page render, I have to check what are page resource (Fields and buttons) exist in that page and then have to check whether the user having authorization to these resources or not.
What would be best way to implement these type of authorization ? As I have more than 300 pages in my application and each page I have to check these authorization and allow to user or not allow to user to do certain actions. Each page will have more than 10 elements (input fields and buttons.).