public AuthUserDataModel GetUserMenuList(AuthUserModel user) { if (user == null || user.UserSysNo <= 0) { AuthUserDataModel result = new AuthUserDataModel(); result.Menus = new List <AuthMenuModel>(); result.Permissions = new List <AuthPermissionModel>(); result.Roles = new List <AuthRoleModel>(); return(result); } string keyWithoutLoginTime = CacheManager.GenerateKey(CACHE_KEY_USER_MENU, this.ApplicationKey, user.UserID); string keyWithLoginTime = CacheManager.GenerateKey(keyWithoutLoginTime, user.UILoginTime); return(CacheManager.GetWithCache <AuthUserDataModel>(keyWithLoginTime, () => { //移除失效的缓存 CacheManager.RemoveStartsWith(keyWithoutLoginTime + "_"); BlueStone.Smoke.Entity.CurrentUser cUser = new Entity.CurrentUser() { UserSysNo = user.UserSysNo, LoginTime = user.UILoginTime, UserName = user.UserID }; return authService.GetUserMenuList(cUser, AuthMgr.GetApplicationKey()); //return Rpc.Call<AuthUserDataModel>("AuthService.AuthService.GetUserMenuList", user.UserSysNo, AuthMgr.GetApplicationKey()); }, 60 * 60 * 8)); }
public void ClearCachedData(AuthUserModel user) { string keyWithoutLoginTime = CacheManager.GenerateKey(CACHE_KEY_USER_MENU, this.ApplicationKey, user.UserID); CacheManager.RemoveStartsWith(keyWithoutLoginTime + "_"); authService.ClearAuthData(user.UserID, AuthMgr.GetApplicationKey()); //Rpc.Call<AuthUserModel>("AuthService.AuthService.ClearAuthData"); }
/// <summary> /// 修改密码 /// </summary> /// <returns></returns> public ActionResult SavePwd() { string OldPassword = Request["OldPassword"]; string new1 = Request["new1"]; string new2 = Request["new2"]; if (new1 != new2) { throw new BusinessException("您输入的新密码与确认密码不匹配 "); } string encrptedPassword = AuthMgr.EncryptPassword(OldPassword); string encrptednew1 = AuthMgr.EncryptPassword(new1); SystemUserService systemUserService = new SystemUserService(); systemUserService.ResetSystemUserPassword(CurrUser.UserName, encrptedPassword, encrptednew1, AuthMgr.GetApplicationKey()); //Rpc.Call<int>("AuthService.ResetSystemUserPassword", CurrUser.UserName, encrptedPassword, encrptednew1, AuthMgr.GetApplicationKey()); AuthMgr.Logout(); return(Json(new AjaxResult { Success = true, Message = "修改成功" }, JsonRequestBehavior.AllowGet)); }