记录[授权]属性的使用,产生了报告 [英] Documenting [Authorize] attribute usage, producing a report

查看:108
本文介绍了记录[授权]属性的使用,产生了报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ASP.NET MVC 3应用程序中的许多类和方法装饰用的 [授权] 的属性,如:

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 {

或本

[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.

我已经使用内置的文档C#的,并使用一个标签一样的备注 的存储这些信息,然后输出入一个XML文件,但似乎笨重 - 我需要重新输入信息,这可以得到不同步的属性,后处理XML文档解析信息和present以可读的形式。

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,

要添加文件到您的方法或类,你可以使用 GhostDoc

To add documentation to your method or class , you can use "GhostDoc"

要创建的文档文件进行上面的XML文件及资料,你可以使用 VSDocMan

To Create documentation file out of above XML Documentations, you can use "VSDocMan"

有关免检产品,

您可以使用沙塔

这篇关于记录[授权]属性的使用,产生了报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆