Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 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());
     }
 }
Exemplo n.º 3
0
 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();
     }
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 public CachedUserAccountInfo(NAAS_USRMGR.UserAccountType userAcct)
 {
     _username  = NAASManager.CleanUpNAASReturnedAccountName(userAcct.userId);
     _affiliate = string.IsNullOrEmpty(userAcct.node) ? userAcct.affiliate : userAcct.node;
 }