Before I embark on a journey down the paths of learning ASP.NET MVC3, I wanted to try and get soem recommendations on something I know I’ll run into. If I have an application with different user/product levels that result in different users being able to perform different functions (e.g. user has signed up for the base level of the product, so they cannot upload audio while users on higher “tiers” can) are there recommendations on how I could handle this cleanly.
Example 1: Have the model or controller do X and have different Y or Z for each product level.
Example 2: Have inline markup in the view that displays feature available to “upper level” roles based on the result of a helper method.
I was thinking maybe there is a way to have different views and/or models and determine which one to hook up to a request based on some criteria.
Thanks, any suggestions would be appreciated.
That should definitely go into both places. For example, if your free tier does not allow for custom domains, whereas your paid ones do, simply removing an
inputfor domain name will not suffice: a user might be able to hand-craft a POST request and include missingaccount.customDomainvalue. Hence, you’ll have to check for tier features in the controller as well.As for where and how to specify these tier restrictions, I too have this problem facin me at the moment. What I came up with is a simple XML file where I specify tier capabilities:
And then a simpe C# class for encapsulating access to this spec and you’re all set.