views:

480

answers:

1

I'm in early phase of building a RIA with ExtJS and ASP.NET MVC.

Users in the system will have numerous different user rights that restrict which elements are visible and what actions user can make.

For example in the user managment section, only superuser should be able to promote user to 'admin' status. So the 'add admin status' -button shouldn't be visible to users who are not superusers.

What would be the best way to dynamically create (or parse) the ExtJS components at the server side with the right composition of elements depending on users rights? These components would then be loaded to the viewport via AJAX-requests.

The example was very minimalistic, but I hope you get my drift. The real life situations are (of course) far more compex and I'd like to find a solution that's intuitive and maintainable.

A: 

Why not just use standard logic in the page to exclude buttons etc. from the UI? On the server side you already know what the user's entitled to do. Is there really a reason to use AJAX requests to conditionally populate the UI? IMO such population should only occur as a result of user actions (e.g. expand a tree node).

Vinay Sajip
Components would be loaded when user makes an action on the page, for example clicks some node in the menu. Not so that all the components would be loaded to viewport at the beginning via AJAX. It should also be possible to have multiple instances of the same component in the viewport. I.e. two "order information" -components with information of two different orders in a tabpanel.
Olli