Пример #1
0
    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));
            }
    }
Пример #2
0
    public bool ProcessSubmission()
    {
        SiteAPI m_refSiteApi = new SiteAPI();
        Hashtable pagedata;
        Hashtable modulelicense;
        Hashtable modulelicenses = new Hashtable();
        Collection prefs = new Collection();
        long FolderId;
        int i = 0;

        pagedata = new Hashtable();

        while (Request.Form["mlicenseid" + (i + 1)] != null && Request.Form["mlicenseid" + (i + 1)].ToString().Length > 0)
        {
            modulelicense = new Hashtable();
            modulelicense.Add("ID", System.Convert.ToInt32(Request.Form["mlicenseid" + (i + 1)]));
            modulelicense.Add("License", Request.Form["mlicense" + (i + 1)]);
            modulelicense.Add("Type", 0);
            modulelicenses.Add(i, modulelicense);
            i++;
            modulelicense = null;
        }
        pagedata.Add("ModuleLicenses", modulelicenses);
        pagedata.Add("LicenseKey", Request.Form["license"]);
        pagedata.Add("AppLanguage", Request.Form["language"]);
        pagedata.Add("SystemEmail", Request.Form["SystemEmaillAddr"]);
        if (Request.Form["SystemAsynchStaging"] != null && (Request.Form["SystemAsynchStaging"]).ToString().Length > 0)
        {
            pagedata.Add("AsynchStaging", 1);
            m_refSiteApi.RequestInformationRef.IsStaging = true;
        }
        else
        {
            pagedata.Add("AsynchStaging", 0);
            m_refSiteApi.RequestInformationRef.IsStaging = false;
        }
        if (Request.Form["SystemAsynchLocation"] != null && (Request.Form["SystemAsynchLocation"]).ToString().Length > 0)
        {
            pagedata.Add("AsynchLocation", Request.Form["SystemAsynchLocation"]);
        }
        else
        {
            pagedata.Add("AsynchLocation", Request.Form["SystemAsynchLocation"]);
        }
        //These settings only appliy to the eWebEditPro editor, other wise set the defaut values in it.
        if (ConfigurationManager.AppSettings["ek_DataDesignControl"] != null && ConfigurationManager.AppSettings["ek_DataDesignControl"].ToString() == "eWebEditPro")
        {
            int ContentSize = 1000000;
            int SummarySize = 65000;
            if (int.TryParse(Request.Form["content_size"], out ContentSize))
            {
                if (ContentSize < 1000000)
                    ContentSize = 1000000;
            }
            if (int.TryParse(Request.Form["summary_size"], out SummarySize))
            {
                if (SummarySize < 65000)
                    SummarySize = 65000;
            }
            pagedata.Add("MaxContentSize", ContentSize.ToString());
            pagedata.Add("MaxSummarySize", SummarySize.ToString());
        }
        else
        {
            pagedata.Add("MaxContentSize", "1000000");
            pagedata.Add("MaxSummarySize", "65000");
        }
        //End content size
        if (Request.Form["EnableMessaging"] != null && Request.Form["EnableMessaging"] != "")
        {
            pagedata.Add("EnableMessaging", 1);
        }
        else
        {
            pagedata.Add("EnableMessaging", 0);
        }
        if (Request.Form["filesystemsupport"] != null && Request.Form["filesystemsupport"] != "")
        {
            pagedata.Add("FileSystemSupport", 1);
        }
        else
        {
            pagedata.Add("FileSystemSupport", 0);
        }
        if (!(Request.Form["PublishPdfEnabled"] == null))
        {
            if (Request.Form["PublishPdfEnabled"] != "")
            {
                pagedata.Add("PublishPdfEnabled", 1);
            }
            else
            {
                pagedata.Add("PublishPdfEnabled", 0);
            }
        }
        else
        {
            pagedata.Add("PublishPdfEnabled", 0);
        }
        if (Request.Form[font_style.UniqueID] != null && (Request.Form[font_style.UniqueID]).ToString().Length > 0)
        {
            pagedata.Add("EnableFontButtons", 1);
        }
        else
        {
            pagedata.Add("EnableFontButtons", 0);
        }
        //If (Len(Request.Form(styles.UniqueID))) Then
        //    pagedata.Add("RemoveStyles", 1)
        //Else
        //    pagedata.Add("RemoveStyles", 0)
        //End If
        if (Request.Form[word_styles.UniqueID] != null && (Request.Form[word_styles.UniqueID]).ToString().Length > 0)
        {
            pagedata.Add("PreserveWordStyles", 1);
        }
        else
        {
            pagedata.Add("PreserveWordStyles", 0);
        }
        if (Request.Form[word_classes.UniqueID] != null && (Request.Form[word_classes.UniqueID]).ToString().Length > 0)
        {
            pagedata.Add("PreserveWordClasses", 1);
        }
        else
        {
            pagedata.Add("PreserveWordClasses", 0);
        }
        pagedata.Add("PreApprovalGroup", "0");
        if (Request.Form[chkVerifyUserOnAdd.UniqueID] == "on")
        {
            pagedata.Add("VerifyUserOnAdd", "1");
        }
        else
        {
            pagedata.Add("VerifyUserOnAdd", "0");
        }
        if (Request.Form[chkEnablePreApproval.UniqueID] == "on")
        {
            pagedata.Add("EnablePreApproval", "1");
        }
        else
        {
            pagedata.Add("EnablePreApproval", "0");
        }
        //if (Request.Form["access"] != null && Request.Form["access"].ToString().Length > 0)
        //{
        //    pagedata.Add("accessibility", Request.Form["access"]);
        //}
        //else
        //{
        //    pagedata.Add("accessibility", 0);
        //}

        //if (access_none.Selected)
        //{
        //    pagedata.Add("accessibility", access_none.Value);
        //}
        //else if (access_loose.Selected)
        //{
        //    pagedata.Add("accessibility", access_loose.Value);
        //}
        //else if (access_strict.Selected)
        //{
        //    pagedata.Add("accessibility", access_strict.Value);
        //}
        //else
        //{
        //    pagedata.Add("accessibility", 0);
        //}

        if (Request.Form[access.UniqueID] != null)
        {
            pagedata.Add("accessibility", Request.Form[access.UniqueID]);
        }
        else
        {
            pagedata.Add("accessibility", 0);
        }

        prefs.Add("9999", "width", null, null);
        prefs.Add("9999", "height", null, null);
        prefs.Add(Request.Form[templatefilename.UniqueID], "template", null, null);
        if (Request.Form[chkSmartDesktop.UniqueID] == "on")
        {
            FolderId = -1;
        }
        else
        {
            if (Request.Form["folderId"] != "")
            {
                FolderId = Convert.ToInt64(Request.Form["folderId"]);
            }
            else
            {
                FolderId = 0;
            }
        }
        prefs.Add(FolderId, "folderid", null, null);
        if (Request.Form[forcePrefs.UniqueID] == "on")
        {
            prefs.Add("1", "forcesetting", null, null);
        }
        else
        {
            prefs.Add("0", "forcesetting", null, null);
        }

        prefs.Add("1", "dispborders", null, null);

        //if (Request.Form[disptitletext.UniqueID] == "on")
        //{
        //    prefs.Add("1", "disptitletext", null, null);
        //}
        //else
        //{
        //    prefs.Add("0", "disptitletext", null, null);
        //}

        m_refSiteApi.UpdateSiteVariables(pagedata);
        Ektron.Cms.DataIO.LicenseManager.LicenseManager.Reset(m_refSiteApi.RequestInformationRef);
        Collection oldUser = new Collection();
        oldUser.Add(Request.Form[userid.UniqueID], "UserID", null, null);
        oldUser.Add(Request.Form[username.UniqueID], "UserName", null, null);
        oldUser.Add(Request.Form["pwd"], "Password", null, null);
        oldUser.Add("", "Domain", null, null);
        oldUser.Add("BUILTIN", "FirstName", null, null);
        oldUser.Add("BUILTIN", "LastName", null, null);
        oldUser.Add("0", "Language", null, null);
        oldUser.Add("", "EditorOptions", null, null);
        oldUser.Add("", "EmailAddr1", null, null);
        oldUser.Add("1", "DisableMsg", null, null);
        if (Request.Form["chkAccountLocked"] != null && Request.Form["chkAccountLocked"] != "")
        {
            oldUser.Add(254, "LoginAttempts", null, null);
        }
        else
        {
            oldUser.Add(0, "LoginAttempts", null, null);
        }
        UserAPI m_refUserApi = new UserAPI();
        m_refUserApi.UpdateUser(oldUser);
        m_refUserApi.UpdateUserPreferences(0, prefs);

        return (true);
    }