UserValidator.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:5k
源码类别:
OA系统
开发平台:
C#
- using System;
- namespace OThinker.H3.Portal
- {
- /// <summary>
- /// 用户权限验证器
- /// </summary>
- [System.Serializable]
- public abstract class UserValidator
- {
- // 用户名
- private string _UserID;
- public string UserID
- {
- get
- {
- return this._UserID;
- }
- }
- private string _UserAlias;
- public string UserAlias
- {
- get
- {
- if (this._UserAlias == null)
- {
- this._UserAlias = ((OThinker.Organization.User)OThinker.H3.Server.Engine.Organization.GetUnit(this.UserID)).Alias;
- }
- return this._UserAlias;
- }
- }
- private string _UserName;
- public string UserName
- {
- get
- {
- if(this._UserName == null)
- {
- this._UserName = OThinker.H3.Server.Engine.Organization.GetName(this.UserID);
- }
- return this._UserName;
- }
- }
- private string _UserFullName;
- public string UserFullName
- {
- get
- {
- if (this._UserFullName == null)
- {
- this._UserFullName = OThinker.H3.Server.Engine.Organization.GetFullName(this.UserID);
- }
- return this._UserFullName;
- }
- }
- private string[] _Delegants = null;
- private bool GotDelegants = false;
- public string[] Delegants1
- {
- get
- {
- if(!this.GotDelegants)
- {
- this._Delegants = OThinker.H3.Server.Engine.Organization.GetUserDelegants(this.UserID, true);
- this.GotDelegants = true;
- }
- return this._Delegants;
- }
- }
- public string[] Delegants2
- {
- get
- {
- System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>(this.Delegants1);
- list.Add(this.UserID);
- return list.ToArray();
- }
- }
- private string[] _RecursiveMemberOfs;
- public string[] RecursiveMemberOfs
- {
- get
- {
- if(this._RecursiveMemberOfs == null)
- {
- this._RecursiveMemberOfs = OThinker.H3.Server.Engine.Organization.GetParents(this.UserID, OThinker.Organization.UnitType.Unspecified, true);
- }
- return this._RecursiveMemberOfs;
- }
- }
- private string[] _MemberOfs;
- public string[] MemberOfs
- {
- get
- {
- if(this._MemberOfs == null)
- {
- this._MemberOfs = OThinker.H3.Server.Engine.Organization.GetParents(this.UserID, OThinker.Organization.UnitType.Unspecified, false);
- }
- return this._MemberOfs;
- }
- }
- private string[] _Groups;
- public string[] Groups
- {
- get
- {
- if (this._Groups == null)
- {
- this._Groups = OThinker.H3.Server.Engine.Organization.GetParentGroups(this.UserID);
- if (this._Groups == null)
- {
- this._Groups = new string[0];
- }
- }
- return this._Groups;
- }
- }
- private string[] _NormalGroups;
- public string[] NormalGroups
- {
- get
- {
- if (this._NormalGroups == null)
- {
- this._NormalGroups = OThinker.H3.Server.Engine.Organization.GetParentGroups(this.UserID, OThinker.Organization.VisibleType.Normal);
- if (this._NormalGroups == null)
- {
- this._NormalGroups = new string[0];
- }
- }
- return this._NormalGroups;
- }
- }
- private string _Email;
- public string Email
- {
- get
- {
- if(this._Email == null)
- {
- this._Email = OThinker.H3.Server.Engine.Organization.GetUserEmail(this.UserID);
- }
- return this._Email;
- }
- }
- private string _ManagerID;
- public string ManagerID
- {
- get
- {
- if(this._ManagerID == null)
- {
- this._ManagerID = OThinker.H3.Server.Engine.Organization.GetManager(this.UserID);
- }
- return this._ManagerID;
- }
- }
- private string _Department;
- public string Department
- {
- get
- {
- if(this._Department == null)
- {
- this._Department = OThinker.H3.Server.Engine.Organization.GetUserDept(this.UserID);
- }
- return this._Department;
- }
- }
- public UserValidator(string UserID)
- {
- this._UserID = UserID;
- }
- public abstract bool ValidateAdministrator();
- public abstract bool ValidatePublishWorkflow();
- public abstract bool ValidateViewReport();
- public abstract bool ValidateWorkflowAdministrator(string WorkflowPackage, string WorkflowName);
- public abstract bool ValidateCreateInstance(string WorkflowPackage, string WorkflowName);
- public abstract bool ValidateInstanceAdministrator(string InstanceId);
- public abstract bool ValidateInstanceView(string InstanceId);
- }
- }