public void ResetPassword(string username, string newPassword) { NAAS_USRMGR.UserAccountType userAccount = GetUserAccount(username); if (userAccount == null) { throw new ArgumentException("An account for the user \"{0}\" was not found.", username); } NAAS_USRMGR.UpdateUser updateUser = new NAAS_USRMGR.UpdateUser(); updateUser.adminName = _usermgrRuntimeCredential.UserName; updateUser.credential = _usermgrRuntimeCredential.Password; updateUser.domain = _usermgrRuntimeCredentialDomain; updateUser.affiliate = userAccount.affiliate; updateUser.owner = userAccount.owner; updateUser.userId = userAccount.userId; updateUser.status = (NAAS_USRMGR.AccountStatusCode) Enum.Parse(typeof(NAAS_USRMGR.AccountStatusCode), userAccount.status); updateUser.userType = NAAS_USRMGR.UserTypeCode.user; updateUser.userPassword = newPassword; try { NAAS_USRMGR.UpdateUserResponse response = _usermgrClient.UpdateUser(updateUser); } catch (Exception e) { throw new ArgException("NAAS returned an error: {0}", e.Message); } }
public NaasUserInfo GetNaasUserInfo(string userName) { NAAS_USRMGR.UserAccountType userAccount = GetUserAccount(userName); if (userAccount != null) { return(new NaasUserInfo(userAccount.userGroup, userAccount.owner, userAccount.affiliate)); } else { return(new NaasUserInfo()); } }
private void AddUserToCachedUsers(NAAS_USRMGR.UserAccountType userAccount) { try { OrderedSet <CachedUserAccountInfo> userAccounts = GetAllUserAccounts(false); CachedUserAccountInfo cachedInfo = new CachedUserAccountInfo(userAccount); userAccounts.Add(cachedInfo); _objectCacheDao.CacheObjectKeepExpiration(userAccounts, CACHE_NAAS_USER_ACCOUNTS); } catch (Exception) { InvalidateCachedUserAccounts(); } }
public bool UserExists(string userName, out string affiliate, out bool canDelete) { NAAS_USRMGR.UserAccountType userAccount = GetUserAccount(userName); if (userAccount != null) { affiliate = userAccount.affiliate; canDelete = string.Equals(userAccount.affiliate, _nodeId, StringComparison.InvariantCultureIgnoreCase); if (canDelete) { canDelete = CanDeleteUser(userName); } } else { affiliate = null; canDelete = false; } return(userAccount != null); }
public CachedUserAccountInfo(NAAS_USRMGR.UserAccountType userAcct) { _username = NAASManager.CleanUpNAASReturnedAccountName(userAcct.userId); _affiliate = string.IsNullOrEmpty(userAcct.node) ? userAcct.affiliate : userAcct.node; }