Example #1
0
 public void SetNetworkEndpointTransactionInfo(string transactionId, string networkId, EndpointVersionType networkEndpointVersion,
                                               string networkEndpointUrl, string networkFlowName, string networkFlowOperation,
                                               string endpointUsername)
 {
     EndpointUserDao.SetNetworkEndpointTransactionInfo(transactionId, networkId, networkEndpointVersion,
                                                       networkEndpointUrl, networkFlowName, networkFlowOperation,
                                                       endpointUsername);
 }
Example #2
0
        public IDictionary <string, SimpleListDisplayInfo> GetListInfo(params string[] args)
        {
            Dictionary <string, SimpleListDisplayInfo> dict = new Dictionary <string, SimpleListDisplayInfo>();

            IList <UserAccount> userAccounts = EndpointUserDao.Get();

            if (!CollectionUtils.IsNullOrEmpty(userAccounts))
            {
                foreach (UserAccount userAccount in userAccounts)
                {
                    string name = userAccount.NaasAccount;
                    dict.Add(userAccount.NaasAccount, new SimpleListDisplayInfo(name, string.Empty));
                }
            }

            return(dict);
        }
Example #3
0
 public UserAccount GetByName(string username, NodeVisit visit)
 {
     try
     {
         ValidateByRole(visit, SystemRoleType.Admin);
         UserAccount account = EndpointUserDao.GetByName(username);
         ActivityManager.LogAudit(NodeMethod.None, null, visit, "{0} got user account: {1}.",
                                  visit.Account.NaasAccount, account.ToString());
         return(account);
     }
     catch (Exception e)
     {
         ActivityManager.LogError(NodeMethod.None, null, e, visit, "{0} failed to get user account: {1}.",
                                  visit.Account.NaasAccount, username);
         throw;
     }
 }
Example #4
0
 public INodeEndpointClient GetNodeEndpointClient(string targetEndpointUrl, EndpointVersionType type, string endpointUsername)
 {
     if (!string.IsNullOrEmpty(endpointUsername))
     {
         string testPassword, prodPassword;
         if (!EndpointUserDao.GetEnpointUserPasswordsByUsername(endpointUsername, out testPassword, out prodPassword))
         {
             throw new ArgumentException(string.Format("The node endpoint user \"{0}\" could not be found.", endpointUsername));
         }
         INodeEndpointClient client = NodeEndpointClientFactory.Make(targetEndpointUrl, type, endpointUsername, testPassword, prodPassword);
         return(client);
     }
     else
     {
         return(NodeEndpointClientFactory.Make(targetEndpointUrl, type));
     }
 }
Example #5
0
        public void Remove(UserAccount instance, NodeVisit visit)
        {
            ValidateByRole(visit, SystemRoleType.Admin);

            if (instance == null)
            {
                throw new ArgumentException("Input values are null.");
            }

            instance.ModifiedById = visit.Account.Id;
            TransactionTemplate.Execute(delegate
            {
                EndpointUserDao.Remove(instance);
                ActivityManager.LogAudit(NodeMethod.None, null, visit, "{0} removed endpoint user: {1}.",
                                         visit.Account.NaasAccount, instance.NaasAccount);
                return(null);
            });
        }
Example #6
0
 public INodeEndpointClient GetNodeEndpointClientForEndpointUserId(string targetEndpointUrl, EndpointVersionType type,
                                                                   string endpointUserId, out string endpointUsername)
 {
     if (string.IsNullOrEmpty(endpointUserId))
     {
         endpointUsername = NodeEndpointClientFactory.DefaultAuthenticationCredentials.UserName;
         return(GetNodeEndpointClient(targetEndpointUrl, type, null));
     }
     else
     {
         UserAccount account = EndpointUserDao.GetById(endpointUserId);
         if (account == null)
         {
             throw new ArgumentException(string.Format("The node endpoint user with id \"{0}\" could not be found.", endpointUserId));
         }
         endpointUsername = account.NaasAccount;
         return(GetNodeEndpointClient(targetEndpointUrl, type, endpointUsername));
     }
 }
Example #7
0
        public UserAccount Save(UserAccount instance, string testNaasPassword, string prodNaasPassword, NodeVisit visit)
        {
            ValidateByRole(visit, SystemRoleType.Admin);

            if ((instance == null) || string.IsNullOrEmpty(instance.NaasAccount) ||
                string.IsNullOrEmpty(testNaasPassword) || string.IsNullOrEmpty(prodNaasPassword))
            {
                throw new ArgumentException("Input values are null.");
            }

            instance.ModifiedById = visit.Account.Id;
            TransactionTemplate.Execute(delegate
            {
                EndpointUserDao.Save(instance, testNaasPassword, prodNaasPassword);
                ActivityManager.LogAudit(NodeMethod.None, null, visit, "{0} saved endpoint user: {1}.",
                                         visit.Account.NaasAccount, instance.NaasAccount);
                return(null);
            });
            return(instance);
        }
Example #8
0
 public IList <UserAccount> GetAllPossibleEndpointUsers(NodeVisit visit)
 {
     ValidateByRole(visit, SystemRoleType.Admin);
     return(EndpointUserDao.GetAllPossibleEndpointUsers());
 }
Example #9
0
 public IDictionary <string, string> GetEndpointUserDisplayList(NodeVisit visit)
 {
     ValidateByRole(visit, SystemRoleType.Program);
     return(EndpointUserDao.GetEndpointUserDisplayList());
 }