Esempio n. 1
0
        public override int ModifyDomainCredentials(string originalGuid, ProcessAgent agent, Coupon inCoupon, Coupon outCoupon, string extra)
        {
            int status = 0;
            ProcessAgentInfo paiOld = GetProcessAgentInfo(agent.agentGuid);
            try
            {
                status = base.ModifyDomainCredentials(originalGuid, agent, inCoupon, outCoupon, extra);
            }
            catch (Exception ex)
            {
                throw new Exception("ISB: ", ex);
            }
            if (paiOld != null)
            {
                if (agent.codeBaseUrl.CompareTo(paiOld.codeBaseUrl) != 0)
                {
                    ModifyAdminUrls(paiOld.agentId, paiOld.codeBaseUrl, agent.codeBaseUrl);
                    ModifyResourceInfoURL(paiOld.agentId, paiOld.codeBaseUrl, agent.codeBaseUrl);
                    if (paiOld.agentType == ProcessAgentType.AgentType.LAB_SERVER)
                    {
                        ModifyClientScripts(paiOld.agentId, paiOld.codeBaseUrl, agent.codeBaseUrl);
                    }
                }
            }
            //Notify all ProcessAgents about the change
            ProcessAgentInfo[] domainServices = GetProcessAgentInfos();
            ProcessAgentProxy proxy = null;
            foreach (ProcessAgentInfo pi in domainServices)
            {
                // Do not send if retired this service or the service being modified since this is
                if (!pi.retired && (pi.agentGuid.CompareTo(ProcessAgentDB.ServiceGuid) != 0)
                    && (pi.agentGuid.CompareTo(agent.agentGuid) != 0))
                {
                    proxy = new ProcessAgentProxy();
                    proxy.AgentAuthHeaderValue = new AgentAuthHeader();
                    proxy.AgentAuthHeaderValue.coupon = pi.identOut;
                    proxy.Url = pi.webServiceUrl;

                    proxy.ModifyDomainCredentials(originalGuid, agent, extra, inCoupon, outCoupon);
                }
            }
            return status;
        }
        public override int ModifyDomainCredentials(string originalGuid, ProcessAgent agent, string extra, 
            Coupon inCoupon, Coupon outCoupon)
        {
            int status = 0;

            if (brokerDB.AuthenticateAgentHeader(agentAuthHeader))
            {
                status = brokerDB.ModifyDomainCredentials(originalGuid, agent, inCoupon, outCoupon, extra);

                //Notify all ProcessAgents about the change
                ProcessAgentInfo[] domainServices = brokerDB.GetProcessAgentInfos();
                ProcessAgentProxy proxy = null;
                foreach (ProcessAgentInfo pi in domainServices)
                {
                    // Do not send if retired this service or the service being modified since this is
                    if (!pi.retired && (pi.agentGuid.CompareTo(ProcessAgentDB.ServiceGuid) != 0)
                        && (pi.agentGuid.CompareTo(agent.agentGuid) != 0))
                    {
                        proxy = new ProcessAgentProxy();
                        proxy.AgentAuthHeaderValue = new AgentAuthHeader();
                        proxy.AgentAuthHeaderValue.agentGuid = ProcessAgentDB.ServiceGuid;
                        proxy.AgentAuthHeaderValue.coupon = pi.identOut;
                        proxy.Url = pi.webServiceUrl;

                        status += proxy.ModifyDomainCredentials(originalGuid, agent, extra, inCoupon, outCoupon);
                    }
                }
            }
            return status;
        }