Example #1
0
        /// <summary>
        /// 根据用户名获取用户
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public static UserProxy GetUser(string username)
        {
            UserProxy user = AsmxAccess.API.User_GetByUsername(username);

            if (user != null)
            {
                DataConvertUtil.ConvertUserUrl(user);
            }
            return(user);
        }
Example #2
0
        /// <summary>
        /// 根据ID获取用户
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static UserProxy GetUser(int userID)
        {
            UserProxy user = AsmxAccess.API.User_GetUser(userID);

            if (user != null)
            {
                DataConvertUtil.ConvertUserUrl(user);
            }
            return(user);
        }
Example #3
0
        static PassportServerConfig()
        {
            PassportInfoProxy config = AsmxAccess.API.Passport_GetInfo();

            LoginUrl           = DataConvertUtil.ConcatUrl(config.LoginUrl);
            LogoutUrl          = DataConvertUtil.ConcatUrl(config.LogoutUrl);
            RegisterUrl        = DataConvertUtil.ConcatUrl(config.RegisterUrl);
            CookieName         = config.CookieName;
            RecoverPasswordUrl = DataConvertUtil.ConcatUrl(config.RecoverPasswordUrl);
            CenterUrl          = DataConvertUtil.ConcatUrl(config.CenterUrl);
        }
Example #4
0
        /// <summary>
        /// 根据COOKIE值获取用户
        /// </summary>
        /// <param name="cookie"></param>
        /// <returns></returns>
        public static UserProxy GetUserByCookieValue(string cookie)
        {
            if (string.IsNullOrEmpty(cookie))
            {
                return(null);
            }

            UserProxy user = null;

            if (CacheUtil.TryGetValue <UserProxy>(cookie, out user) == false)
            {
                user = AsmxAccess.API.User_ValidateTicket(cookie);
                if (user != null)
                {
                    DataConvertUtil.ConvertUserUrl(user);
                    CacheUtil.Set <UserProxy>(cookie, user);
                }
            }

            return(user);
        }