private bool Update() { try { int i; string Org; string Port; string LDAPDomain = ""; Array arrLDAPDomain; Array arrOrgU; Array arrOrgUSep; long arrCount2; long arrCount; string sChar = ":"; Hashtable page_addata = new Hashtable(); System.Collections.Specialized.NameValueCollection pagedata = new System.Collections.Specialized.NameValueCollection(); for (i = 1; i <= System.Convert.ToInt32(Request.Form[userpropcount.UniqueID]); i++) { if (!string.IsNullOrEmpty(Request.Form["userpropvalue" + i.ToString()])) { pagedata.Add(Request.Form["userpropname" + i.ToString()].ToString(), Request.Form["userpropvalue" + i.ToString()].ToString()); } } UserAPI m_refUserApi = new UserAPI(); //TODO: The following comments added by UDAI on 11/22/05. for defect#16785 //while implementing LDAP, ADGroupSelect hardcoded and widely used in this page for VS2003. I am keeping the same hardcode //parameter according to VS2005 (: to $). This page needs radio group using servercontrol property. //TODO: The following comments added by SCOTTK on 1/04/06. for defect# 17121 & 17367 // We were getting issues with the : to $ switch in 5.1.x, so I am placing code here to detect the right char to show if (!string.IsNullOrEmpty(Request.Form[UniqueID + "$ADGroupSelect"])) { sChar = "$"; } else if (!string.IsNullOrEmpty(Request.Form[UniqueID + "_ADGroupSelect"])) { sChar = "_"; } else { sChar = ":"; } if (Request.Form[UniqueID + sChar + "ADGroupSelect"] == "enable_adauth") { //only update user properties if AD Authentication is to be enabled m_refUserApi.UpdateADMapping(m_refUserApi.UserId, pagedata); } if (Request.Form[UniqueID + sChar + "ADGroupSelect"] == "enable_adauth") { page_addata.Add("ADAuthentication", 1); } else if (Request.Form[UniqueID + sChar + "ADGroupSelect"] == "disable_adauth") { page_addata.Add("ADAuthentication", 0); } else { page_addata.Add("ADAuthentication", 2); } if (!string.IsNullOrEmpty(Request.Form[EnableADInt.UniqueID])) { page_addata.Add("ADIntegration", 1); } else { page_addata.Add("ADIntegration", 0); } if (!string.IsNullOrEmpty(Request.Form[EnableAutoUser.UniqueID])) { page_addata.Add("ADAutoUserAdd", 1); } else { page_addata.Add("ADAutoUserAdd", 0); } page_addata.Add("ADAutoUserAddType", Request.Form[drpAutoAddType.UniqueID]); if (!string.IsNullOrEmpty(Request.Form[EnableAutoUserToGroup.UniqueID])) { page_addata.Add("ADAutoUserToGroup", 1); } else { page_addata.Add("ADAutoUserToGroup", 0); } if (Request.Form[UniqueID + sChar + "ADGroupSelect"] == "enable_adauth") { if (!string.IsNullOrEmpty(Request.Form["domainname"])) { page_addata.Add("ADDomainName", Request.Form["domainname"].ToString()); } } else if (Request.Form[UniqueID + sChar + "ADGroupSelect"] == "enable_LDAP") { Org = Request.Form[ServerText.UniqueID].ToString(); Port = Request.Form[PortText.UniqueID].ToString(); if (Request.Form[LDAPDomainText.UniqueID] != null) arrLDAPDomain = (Request.Form[LDAPDomainText.UniqueID].ToString()).Split('.'); else arrLDAPDomain = new List<string>().ToArray(); for (arrCount = 0; arrCount <= (arrLDAPDomain.Length - 1); arrCount++) { if (!(LDAPDomain == "")) { LDAPDomain += ","; } LDAPDomain += "dc="; LDAPDomain += arrLDAPDomain.GetValue(arrCount).ToString(); } arrCount = 0; Org += "</p>"; Org += Port; if (!string.IsNullOrEmpty(LDAPDomain)) { Org += "</p>"; Org += LDAPDomain; } Org += "</server>"; arrOrgUSep = (Request.Form[OrgUnitText.UniqueID].ToString()).Split(new string[] {"</>"}, StringSplitOptions.None); for (arrCount2 = 0; arrCount2 <= (arrOrgUSep.Length - 1); arrCount2++) { if (!(arrOrgUSep.GetValue(arrCount2).ToString() == "")) { arrOrgU = Strings.Split(arrOrgUSep.GetValue(arrCount2).ToString(), ",", -1, 0); bool first; first = true; for (arrCount = 0; arrCount <= (arrOrgU.Length - 1); arrCount++) { if (!(arrOrgU.GetValue(arrCount).ToString() == "")) { if (!(first)) { Org += ","; } first = false; //Org &= "ou=" Org += arrOrgU.GetValue(arrCount).ToString(); } } Org += "</>"; } } if (!string.IsNullOrEmpty(Request.Form[OrgText.UniqueID])) { Org += "o="; Org += Request.Form[OrgText.UniqueID].ToString(); } Org += (string) ("</server>" + Request.Form[drp_LDAPtype.UniqueID]); if (!string.IsNullOrEmpty(Request.Form[LDAP_SSL.UniqueID])) { Org += "</server>" + "SSL"; } else { Org += "</server>"; } if (!string.IsNullOrEmpty(Request.Form[txtLDAPAttribute.UniqueID])) { Org += (string) ("</server>" + Ektron.Cms.Common.EkFunctions.GetDbString(Request.Form[txtLDAPAttribute.UniqueID], 20, true)); } else { Org += "</server>"; } page_addata.Add("ADDomainName", Org); } else { if (!string.IsNullOrEmpty(Request.Form["domainname"])) { page_addata.Add("ADDomainName", Request.Form["domainname"].ToString()); } } SiteAPI m_refSiteApi = new SiteAPI(); m_refSiteApi.UpdateSiteVariables(page_addata); if (!string.IsNullOrEmpty(Request.Form[EnableADInt.UniqueID])) { //only update admin mapping if AD turned on m_refUserApi.MapCMSUserGroupToAD(1, Request.Form[admingroupname.UniqueID].ToString(), Request.Form[admingroupdomain.UniqueID].ToString()); } return (true); //Response.Redirect("adconfigure.aspx", False) } catch (Exception ex) { throw (new Exception(ex.Message)); } }