全面修正分级授权,去掉Anonymous,采用Authenticate进行授权

This commit is contained in:
yubaolee
2016-05-26 20:10:22 +08:00
parent b3c6df2931
commit 855f97df7d
24 changed files with 227 additions and 244 deletions

View File

@@ -46,10 +46,10 @@ namespace OpenAuth.Mvc.Controllers
if (function == null)
throw new Exception("未能找到Action");
var anonymous = function.GetCustomAttribute(typeof(AnonymousAttribute));
var authorize = function.GetCustomAttribute(typeof(AuthenticateAttribute));
var module = loginUser.Modules.FirstOrDefault(u => u.Url.ToLower().Contains(controllername));
//当前登录用户没有Action记录&&Action没有anonymous标识
if (module == null && anonymous == null)
if (authorize != null && module == null)
{
filterContext.Result = new RedirectResult("/Login/Index");
return;