コード例 #1
0
ファイル: ServiceBase.cs プロジェクト: zwjhuhu/Insight_Base
        /// <summary>
        /// 会话合法性验证
        /// </summary>
        /// <param name="key">操作权限代码,默认为空,即不进行鉴权</param>
        /// <param name="id">用户ID</param>
        /// <returns>bool 身份是否通过验证</returns>
        protected bool verify(string key = null, string id = null)
        {
            var verify = new Verify();

            tokenId = verify.tokenId;
            manage  = verify.manage;
            if (manage == null)
            {
                return(false);
            }

            appId      = manage.getAppId();
            tenantId   = manage.getTenantId();
            tenantCode = manage.getTenantCode();
            tenantName = manage.getTenantName();
            deptId     = manage.getDeptId();
            deptCode   = manage.getDeptCode();
            deptName   = manage.getDeptName();
            userId     = manage.userId;
            userName   = manage.userName;
            result     = verify.compare(userId == id ? null : key);

            return(result.successful);
        }