I'm building a new ExtJS4 MVC application with Web API (server side) that will have login and actions based on a user role. For example instead of having just roles like:
- Admin
- Administrative
- HumanResources
I have a collection of actions and access types like
Action (Access Type)
- Person.Delete (Full Access)
- Person.ShowDetail (ReadOnly)
- Report.Person.Accouting (None)
- etc...
I have two approaches:
- Implementing the validation Server side (Web API Methods)
- Implementing the validation Client side (ExtJS)
If I choose to go for server side, then the user will see all the buttons, fields, etc. but for example if there is a "Print Report" button and if the user hasn't authorization to print the report, the user will click the button then a server side request is made and the Web API will check if the current user is allowed to access that method or not and then return a message to the client.
I'm not a big fan of server side approach because the user will hit the server all time even when he is not allowed to do a some action.
So I don't really know how can I implement this approach in order to show, hide, disable buttons, fields, etc. maybe is a mixture of both approaches.
Hope someone can give me a best understanding.