ASP.NET MVC 4使用權限代碼自定義授權屬性(無角色)我需要在我的MVC 4應用程序中根據用戶權限級別(沒有角色,只分配給用戶的CRUD操作級別的權限級別)來控制對視圖的訪問。舉個例子; 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使用權限代碼自定義授權屬性(無角色)
慕碼人8056858
2019-08-09 15:44:10