Example #1
0
 // *********************************************************************
 //  GetRoleConfiguration
 //
 /// <summary>
 /// Internal class used to populate default role changes.
 /// </summary>
 /// <param name="node">XmlNode of the configurations.</param>
 /// 
 // ***********************************************************************/
 internal void GetRoleConfiguration(XmlNode node)
 {
     try
     {
         XmlSerializer serializer = new XmlSerializer(typeof (RolesConfiguration));
         roleConfiguration = serializer.Deserialize(new XmlNodeReader(node)) as RolesConfiguration;
     }
     catch
     {
         //Should we let exception go?
         roleConfiguration = new RolesConfiguration();
     }
 }
Example #2
0
        // *********************************************************************
        //  LoadValuesFromConfigurationXml
        //
        /// <summary>
        /// Loads the forums configuration values.
        /// </summary>
        /// <param name="node">XmlNode of the configuration section to parse.</param>
        /// 
        // ***********************************************************************/
        internal void LoadValuesFromConfigurationXml()
        {
            XmlNode node = GetConfigSection("CommunityServer/Core");

            XmlAttributeCollection attributeCollection = node.Attributes;

            // Get the default language
            //

            XmlAttribute att = attributeCollection["defaultLanguage"];
            if(att != null)
                defaultLanguage =att.Value;
            else
                defaultLanguage = "en-US";

            att = attributeCollection["filesPath"];
            if(att != null)
                filesPath = att.Value;
            else
                filesPath = "/";

            att = attributeCollection["applicationKeyOverride"];
            if(att != null)
                applicationKeyOverride = att.Value;

            att = attributeCollection["disableThreading"];
            if(att != null)
                disableBackgroundThreads = bool.Parse(att.Value);

            att = attributeCollection["disableIndexing"];
            if(att != null)
                disableIndexing = bool.Parse(att.Value);

            att = attributeCollection["cacheFactor"];
            if(att != null)
                cacheFactor = Int32.Parse(att.Value);
            else
                cacheFactor = 5;

            att = attributeCollection["disableEmail"];
            if(att != null)
                disableEmail = bool.Parse(att.Value);

            att = attributeCollection["smtpServerConnectionLimit"];
            if(att != null)
                smtpServerConnectionLimit = short.Parse(att.Value);
            else
                smtpServerConnectionLimit = -1;

            att = attributeCollection["enableLatestVersionCheck"];
            if(att != null)
                enableLatestVersionCheck = bool.Parse(att.Value);

            att = attributeCollection["backwardsCompatiblePasswords"];
            if(att != null)
                backwardsCompatiblePasswords = bool.Parse(att.Value);

            att = attributeCollection["textEditorType"];
            if(att != null)
                textEditorType = att.Value;
            else
                textEditorType =  "CommunityServer.Controls.DefaultTextEditor,CommunityServer.Controls";

            att = attributeCollection["applicationOverride"];
            if(att != null)
                applicationOverride = att.Value;
            else
                applicationOverride = null;

            att = attributeCollection["systemType"];
            if(att != null)
                systemType =  (SystemType)Enum.Parse(typeof(SystemType),attributeCollection["systemType"].Value);
            else
                systemType = SystemType.Self;

            att = attributeCollection["wwwStatus"];
            if(att != null)
                _wwwStatus = (WWWStatus)Enum.Parse(typeof(WWWStatus),attributeCollection["wwwStatus"].Value);

            // ��ȡĬ�ϸ������淽ʽ
            //
            att = attributeCollection["AttachmentSaveMode"];
            if(att != null)
            {
                try
                {
                    attachmentSaveMode = (FileSaveMode)Enum.Parse(typeof(FileSaveMode), attributeCollection["AttachmentSaveMode"].Value);
                }
                catch{}
            }

            // ��ȡĬ�ϸ������淽ʽ
            //
            att = attributeCollection["AvatarSaveMode"];
            if(att != null)
            {
                try
                {
                    avatarSaveMode = (FileSaveMode)Enum.Parse(typeof(FileSaveMode), attributeCollection["AvatarSaveMode"].Value);
                }
                catch{}
            }

            // ��ȡ��������·��
            //
            att = attributeCollection["AttachmentsPath"];
            if(att != null)
                attachmentsPath = att.Value;

            // ��ȡͷ�񱣴�·��
            //
            att = attributeCollection["AvatarsPath"];
            if(att != null)
                avatarsPath = att.Value;

            att = attributeCollection["requireSSL"];
            if(att != null)
                requireSSL = bool.Parse(att.Value);

            XmlAttribute roles = attributeCollection["defaultRoles"];
            if(roles != null)
            {
                _defaultRoles = roles.Value.Split(';');
            }

            // Read child nodes
            //
            foreach (XmlNode child in node.ChildNodes)
            {

                if (child.Name == "providers")
                    GetProviders(child, providers);

                if(child.Name == "appLocation")
                    GetAppLocation(child);

                if (child.Name == "extensionModules")
                    GetProviders(child, extensions);

                if(child.Name == "roleConfiguration")
                    GetRoleConfiguration(child);

            }

            //if we do not have an application, create the default one
            if(app == null)
            {
                app = AppLocation.Default();
            }

            if(roleConfiguration == null)
            {
                roleConfiguration = new RolesConfiguration();
            }
        }
Example #3
0
File: Roles.cs Project: pcstx/OA
 static Roles()
 {
     rolesConfig = CSConfiguration.GetConfig().RolesConfiguration;
     defaultRoles = rolesConfig.RoleList();
 }