Example #1
0
        /// <summary>
        /// Generates a clone of this security setting configuration.
        /// </summary>
        /// <returns></returns>
        public virtual object Clone()
        {
            var newValue = new ExternalFile();

            CopyTo(newValue);
            return(newValue);
        }
Example #2
0
        /// <summary>
        /// Deserialises an <see cref="XmlElement"/> containing security settings configuration.
        /// </summary>
        /// <param name="element">The <see cref="XmlElement"/> to deserialise.</param>
        public override void Deserialize(XmlElement element)
        {
            Type         = "External File-based";
            DefaultRight = Util.GetEnumFromElementOrAttribute <SecurityRight>("defaultRight", element);

            foreach (XmlElement ele in element.SelectNodes("files/*"))
            {
                var externalFile = new ExternalFile();
                externalFile.Deserialize(ele);
                Files.Add(externalFile);
            }

            foreach (XmlElement ele in element.SelectNodes("audit/*"))
            {
                SecurityLogger logger = Util.CreateInstanceFromXmlName <SecurityLogger>(ele.Name);
                if (logger != null)
                {
                    logger.Deserialize(ele);
                    AuditLoggers.Add(logger);
                }
            }

            XmlElement readerEl = element.SelectSingleNode("auditReader") as XmlElement;

            if (readerEl != null)
            {
                string xmlName             = readerEl.GetAttribute("type");
                SecurityAuditReader reader = Util.CreateInstanceFromXmlName <SecurityAuditReader>(xmlName);
                if (reader != null)
                {
                    reader.Deserialize(readerEl);
                    AuditReader = reader;
                }
            }

            XmlElement cacheEl = element.SelectSingleNode("cache") as XmlElement;

            if (cacheEl != null)
            {
                string        xmlName = cacheEl.GetAttribute("type");
                SecurityCache cache   = Util.CreateInstanceFromXmlName <SecurityCache>(xmlName);
                if (cache != null)
                {
                    cache.Deserialize(cacheEl);
                    Cache = cache;
                }
            }
        }
Example #3
0
 /// <summary>
 /// Copies the settings to another instance of this class.
 /// </summary>
 /// <param name="value">The target instance.</param>
 protected virtual void CopyTo(ExternalFile value)
 {
     value.Location = Location;
 }