PermissionAttribute.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // <author></author>
  2. // <date></date>
  3. // <description></description>
  4. using ERP.Framework.Constants;
  5. using ERP.Framework.Security;
  6. using Microsoft.AspNetCore.Mvc.Filters;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace ERP.Framework.Attribute
  13. {
  14. /// <summary>
  15. /// 接口权限特性
  16. /// </summary>
  17. [AttributeUsage(AttributeTargets.Method)]
  18. public class PermissionAttribute : ActionFilterAttribute
  19. {
  20. //internal string Code { get; set; }
  21. //public PermissionAttribute(string code)
  22. //{
  23. // Code = code;
  24. //}
  25. //public override void OnActionExecuted(ActionExecutedContext context)
  26. //{
  27. // var loginUser = LoginHelper.GetLoginUser();
  28. // if (loginUser.Permission.Contains(FrameworkConstant.AdminPermission))
  29. // {
  30. // return;
  31. // }
  32. // if (!loginUser.Permission.Contains(this.Code))
  33. // {
  34. // throw new Exception(AuthI18N.NoPermission);
  35. // }
  36. //}
  37. }
  38. }