1.定义身份实体对象

 1     /// <summary>
 2     /// 网站用户实体对象
 3     /// </summary>
 4     public class DDTPrincipal : IPrincipal
 5     {
 6         public int? OrgCode { get; set; }
 7         public string RoleName { get; set; }
 8         public string OrgName { get; set; }
 9         private IIdentity _identity;
10 
11         public DDTPrincipal(string orgcode, string roleName, string orgName, IIdentity identity)
12         {
13             int _orgCode;
14             int.TryParse(orgcode, out _orgCode);
15             OrgCode =  _orgCode;
16             OrgName = orgName;
17             RoleName = roleName;
18             _identity = identity;
19         }
20 
21         public IIdentity Identity
22         {
23             get { return _identity; }
24         }
25 
26         public bool IsInRole(string role)
27         {
28             return RoleName.IndexOf(role)>=0;
29         }
30     }
View Code

相关文章:

  • 2018-08-08
  • 2019-10-25
  • 2021-10-08
  • 2021-08-03
  • 2021-11-27
  • 2021-09-27
  • 2019-08-01
  • 2021-09-11
猜你喜欢
  • 2018-01-09
  • 2018-06-29
  • 2020-02-15
  • 2020-06-24
  • 2017-12-18
  • 2021-11-13
  • 2020-11-04
  • 2019-05-30
相关资源
相似解决方案