title: .net MVC 4 Authorization (Membership)
body: <p>During my first steps in .NET MVC 4 I'm creating a web site and I would like to implement users authentication/authorization.</p>
  
  <p>In my implementation I would like to be able to link controls to roles. For example, if I have 2 Roles in my system : Admin and User, the in some view say I have 3 inputs:</p>
  
  <pre><code>            &lt;input class="search-field rounded" id="field1" type="text"/&gt;
              &lt;input type="submit" name="submit"/&gt;
  
              &lt;input class="search-field rounded" id="field2" type="text"/&gt;
              &lt;input type="submit" name="submit"/&gt;
  
              &lt;input class="search-field rounded" id="field3" type="text"/&gt;
              &lt;input type="submit" name="submit"/&gt;
  </code></pre>
  
  <p>I would like that an Admin will be able to see and edit all 3 fields in this view, but a User should only see 2 of them, and be able to edit one of them (this is just an example).</p>
  
  <p>So basically, I would like to be able to define permissions for controls, and a role should be consisted of a collection of permissions (If you can think of a better approach I would love to hear it).</p>
  
  <p>So those are my constraints, and I see quite a few packages out there (such as <a href="http://www.fluentsecurity.net/" rel="nofollow">Fluent Security</a>, and <a href="http://www.mvccentral.net/Story/Details/tools/kahanu/securityguard-nuget-package-for-asp-net-membership" rel="nofollow">Security Guard</a>) that relates to the subject, but I'm not quite sure which is best to tackle my challenge if at all.</p>
  
  <p>Is there a best practice to overcome this demand?</p>
  
  <p>Any help is highly appreciated.</p>