Many classes and methods within my ASP.NET MVC 3 application are decorated with the [Authorize] attribute, like this:
[Authorize(Roles = "assignment_edit, assignment_view")]
public class AssignmentController : Controller {
or this:
[HttpPost]
[Authorize(Roles = "assignment_edit")]
public ActionResult Create(AssignmentViewModel assignment)
{
I’d like to find a way to document what classes and methods are limited to particular roles and users, and produce a report grouped by role or class indicating who is authorized to do what. This would make it easier to know what role to grant to a user if they need to perform certain actions.
I’ve considered using C#’s built in documentation and using a tag like remarks to store this information, then outputting it into an xml file, but it seems clunky — I’d need to re-type in information which could get out of synch with the attribute, and post-process the XML document to parse the information and present it in a readable form.
I’m curious whether anyone else has had a similar need and whether any tools or processes exist for tackling this problem?
There are several tools available,
For example,
To add documentation to your method or class , you can use “GhostDoc“
To Create documentation file out of above XML Documentations, you can use “VSDocMan“
For free products,
You can use SandCastle