ASP.NET MVC 4使用權(quán)限代碼自定義授權(quán)屬性(無(wú)角色)我需要在我的MVC 4應(yīng)用程序中根據(jù)用戶權(quán)限級(jí)別(沒(méi)有角色,只分配給用戶的CRUD操作級(jí)別的權(quán)限級(jí)別)來(lái)控制對(duì)視圖的訪問(wèn)。舉個(gè)例子; AuthorizeUser下面將是我的自定義屬性,我需要像這樣使用它:[AuthorizeUser(AccessLevels="Read Invoice, Update Invoice")]public ActionResult UpdateInvoice(int invoiceId){
// some code...
return View();}[AuthorizeUser(AccessLevels="Create Invoice")]public ActionResult CreateNewInvoice(){
// some code...
return View();}[AuthorizeUser(AccessLevels="Delete Invoice")]public ActionResult DeleteInvoice(int invoiceId){
// some code...
return View();}有可能這樣做嗎?
ASP.NET MVC 4使用權(quán)限代碼自定義授權(quán)屬性(無(wú)角色)
慕碼人8056858
2019-08-09 15:44:10