UserValidator.cs
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:5k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. namespace OThinker.H3.Portal
  3. {
  4. /// <summary>
  5. /// 用户权限验证器
  6. /// </summary>
  7. [System.Serializable]
  8. public abstract class UserValidator
  9. {
  10. // 用户名
  11. private string _UserID;
  12. public string UserID
  13. {
  14. get
  15. {
  16. return this._UserID;
  17. }
  18. }
  19.         private string _UserAlias;
  20.         public string UserAlias
  21.         {
  22.             get
  23.             {
  24.                 if (this._UserAlias == null)
  25.                 {
  26.                     this._UserAlias = ((OThinker.Organization.User)OThinker.H3.Server.Engine.Organization.GetUnit(this.UserID)).Alias;
  27.                 }
  28.                 return this._UserAlias;
  29.             }
  30.         }
  31. private string _UserName;
  32. public string UserName
  33. {
  34. get
  35. {
  36. if(this._UserName == null)
  37. {
  38.                     this._UserName = OThinker.H3.Server.Engine.Organization.GetName(this.UserID);
  39. }
  40. return this._UserName;
  41. }
  42. }
  43.         private string _UserFullName;
  44.         public string UserFullName
  45.         {
  46.             get
  47.             {
  48.                 if (this._UserFullName == null)
  49.                 {
  50.                     this._UserFullName = OThinker.H3.Server.Engine.Organization.GetFullName(this.UserID);
  51.                 }
  52.                 return this._UserFullName;
  53.             }
  54.         }
  55.         private string[] _Delegants = null;
  56.         private bool GotDelegants = false;
  57.         public string[] Delegants1
  58.         {
  59.             get
  60.             {
  61.                 if(!this.GotDelegants)
  62.                 {
  63.                     this._Delegants = OThinker.H3.Server.Engine.Organization.GetUserDelegants(this.UserID, true);
  64.                     this.GotDelegants = true;
  65.                 }
  66.                 return this._Delegants;
  67.             }
  68.         }
  69.         public string[] Delegants2
  70.         {
  71.             get
  72.             {
  73.                 System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>(this.Delegants1);
  74.                 list.Add(this.UserID);
  75.                 return list.ToArray();
  76.             }
  77.         }
  78. private string[] _RecursiveMemberOfs;
  79. public string[] RecursiveMemberOfs
  80. {
  81. get
  82. {
  83. if(this._RecursiveMemberOfs == null)
  84. {
  85.                     this._RecursiveMemberOfs = OThinker.H3.Server.Engine.Organization.GetParents(this.UserID, OThinker.Organization.UnitType.Unspecified, true);
  86. }
  87. return this._RecursiveMemberOfs;
  88. }
  89. }
  90. private string[] _MemberOfs;
  91. public string[] MemberOfs
  92. {
  93. get
  94. {
  95. if(this._MemberOfs == null)
  96. {
  97.                     this._MemberOfs = OThinker.H3.Server.Engine.Organization.GetParents(this.UserID, OThinker.Organization.UnitType.Unspecified, false);
  98. }
  99. return this._MemberOfs;
  100. }
  101. }
  102.         private string[] _Groups;
  103.         public string[] Groups
  104.         {
  105.             get
  106.             {
  107.                 if (this._Groups == null)
  108.                 {
  109.                     this._Groups = OThinker.H3.Server.Engine.Organization.GetParentGroups(this.UserID);
  110.                     if (this._Groups == null)
  111.                     {
  112.                         this._Groups = new string[0];
  113.                     }
  114.                 }
  115.                 return this._Groups;
  116.             }
  117.         }
  118.         private string[] _NormalGroups;
  119.         public string[] NormalGroups
  120.         {
  121.             get
  122.             {
  123.                 if (this._NormalGroups == null)
  124.                 {
  125.                     this._NormalGroups = OThinker.H3.Server.Engine.Organization.GetParentGroups(this.UserID, OThinker.Organization.VisibleType.Normal);
  126.                     if (this._NormalGroups == null)
  127.                     {
  128.                         this._NormalGroups = new string[0];
  129.                     }
  130.                 }
  131.                 return this._NormalGroups;
  132.             }
  133.         }
  134. private string _Email;
  135. public string Email
  136. {
  137. get
  138. {
  139. if(this._Email == null)
  140. {
  141.                     this._Email = OThinker.H3.Server.Engine.Organization.GetUserEmail(this.UserID);
  142. }
  143. return this._Email;
  144. }
  145. }
  146. private string _ManagerID;
  147. public string ManagerID
  148. {
  149. get
  150. {
  151. if(this._ManagerID == null)
  152. {
  153.                     this._ManagerID = OThinker.H3.Server.Engine.Organization.GetManager(this.UserID);
  154. }
  155. return this._ManagerID;
  156. }
  157. }
  158. private string _Department;
  159. public string Department
  160. {
  161. get
  162. {
  163. if(this._Department == null)
  164. {
  165.                     this._Department = OThinker.H3.Server.Engine.Organization.GetUserDept(this.UserID);
  166. }
  167. return this._Department;
  168. }
  169. }
  170.         public UserValidator(string UserID)
  171. {
  172.             this._UserID = UserID;
  173. }
  174. public abstract bool ValidateAdministrator();
  175. public abstract bool ValidatePublishWorkflow();
  176.         public abstract bool ValidateViewReport();
  177. public abstract bool ValidateWorkflowAdministrator(string WorkflowPackage, string WorkflowName);
  178. public abstract bool ValidateCreateInstance(string WorkflowPackage, string WorkflowName);
  179. public abstract bool ValidateInstanceAdministrator(string InstanceId);
  180. public abstract bool ValidateInstanceView(string InstanceId);
  181. }
  182. }