Пример #1
0
        public DCUser2 AuthenticateUser(string sessionid, string username, string pwd, string pwdattempts)
        {
            UserBiz     m_ubiz = new UserBiz();
            User2Detail dtuser = null;
            DCUser2     dcusr  = null;
            GroupBiz    m_gbiz = new GroupBiz();

            try
            {
                dtuser = m_ubiz.AuthenticateUser(CryptoUtils.DecryptTripleDES(username), CryptoUtils.DecryptTripleDES(pwd),
                                                 GMConvert.GetInt16(CryptoUtils.DecryptTripleDES(pwdattempts)));
                if (dtuser != null && dtuser.LastLogon.HasValue)
                {
                    dtuser.Permissions = new List <int>();
                    List <Int32> groups = m_ubiz.GetGroups(dtuser.ID);
                    foreach (int group in groups)
                    {
                        dtuser.Permissions.AddRange(m_gbiz.GetPermissions(group));
                    }

                    dcusr = new DCUser2();
                    GMReflectionUtils.Copy(dtuser, dcusr);
                    SetCache(sessionid, dcusr);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
            finally { m_ubiz.Dispose(); m_gbiz.Dispose(); }
            return(dcusr);
        }