public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            IbnContainerConfiguration cnfg = new IbnContainerConfiguration();

            foreach(XmlNode item in section.ChildNodes)
            {
                // Step 1. Extract Container
                if(item.Name=="container")
                {
                    IbnContainerInfo container = new IbnContainerInfo(item.Attributes["name"].Value);

                    // Step 2. Extract Conrol Infos.
                    foreach(XmlNode xmlControlNode in item.ChildNodes)
                    {
                        if(xmlControlNode.Name=="control")
                        {
                            IbnControlInfo control = new IbnControlInfo(xmlControlNode.Attributes["name"].Value,
                                xmlControlNode.Attributes["type"].Value);

                            // Step 3. Extract Parameters
                            foreach(XmlNode xmlParamNode in xmlControlNode.SelectNodes("params/param"))
                            {
                                control.Parameters.Add(xmlParamNode.Attributes["name"].Value,xmlParamNode.Attributes["value"].Value);
                            }

                            // Step 4. Extract ACL
                            foreach(XmlNode xmlACLNode in xmlControlNode.SelectNodes("acl"))
                            {
                                string Filter = "*";

                                if(xmlACLNode.Attributes["containerKey"]!=null)
                                    Filter = xmlACLNode.Attributes["containerKey"].Value;

                                foreach(XmlNode xmlACENode in xmlACLNode.SelectNodes("ace"))
                                {
                                    if(xmlACENode.Attributes["role"]!=null)
                                        // Role Ace
                                        control.DefaultAccessControlList.Add(Filter, new AccessControlEntry(xmlACENode.Attributes["role"].Value,
                                            xmlACENode.Attributes["action"].Value,bool.Parse(xmlACENode.Attributes["allow"].Value)));
                                    else
                                        // Principal Ace
                                        control.DefaultAccessControlList.Add(Filter, new AccessControlEntry(int.Parse(xmlACENode.Attributes["principalid"].Value),
                                            xmlACENode.Attributes["action"].Value,bool.Parse(xmlACENode.Attributes["allow"].Value)));
                                }
                            }

                            container.Controls.Add(control);
                        }
                    }

                    cnfg.Containers.Add(container);
                }
            }

            return cnfg;
        }
Пример #2
0
        public IIbnControl      LoadControl(string name)
        {
            IbnControlInfo controlInfo = this.Info.Controls[name];

            if (controlInfo == null)
            {
                throw new ArgumentException("Invalid agument.", "name");
            }

            IIbnControl retVal = (IIbnControl)AssemblyHelper.LoadObject(controlInfo.Type, typeof(IIbnControl));

            retVal.Init(this, controlInfo);

            return(retVal);
        }
Пример #3
0
 public void Add(IbnControlInfo item)
 {
     this.InnerHashtable.Add(item.Name,item);
 }
Пример #4
0
 public void Init(IIbnContainer owner, IbnControlInfo controlInfo)
 {
     _ownerContainer = owner;
     _info           = controlInfo;
 }
Пример #5
0
 /// <summary>
 /// Inits the specified owner.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="controlInfo">The control info.</param>
 public void Init(IIbnContainer owner, IbnControlInfo controlInfo)
 {
     _ownerContainer = owner;
     //_containerKey = owner.Key;
     _info = controlInfo;
 }
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            IbnContainerConfiguration cnfg = new IbnContainerConfiguration();

            foreach (XmlNode item in section.ChildNodes)
            {
                // Step 1. Extract Container
                if (item.Name == "container")
                {
                    IbnContainerInfo container = new IbnContainerInfo(item.Attributes["name"].Value);

                    // Step 2. Extract Conrol Infos.
                    foreach (XmlNode xmlControlNode in item.ChildNodes)
                    {
                        if (xmlControlNode.Name == "control")
                        {
                            IbnControlInfo control = new IbnControlInfo(xmlControlNode.Attributes["name"].Value,
                                                                        xmlControlNode.Attributes["type"].Value);

                            // Step 3. Extract Parameters
                            foreach (XmlNode xmlParamNode in xmlControlNode.SelectNodes("params/param"))
                            {
                                control.Parameters.Add(xmlParamNode.Attributes["name"].Value, xmlParamNode.Attributes["value"].Value);
                            }

                            // Step 4. Extract ACL
                            foreach (XmlNode xmlACLNode in xmlControlNode.SelectNodes("acl"))
                            {
                                string Filter = "*";

                                if (xmlACLNode.Attributes["containerKey"] != null)
                                {
                                    Filter = xmlACLNode.Attributes["containerKey"].Value;
                                }

                                foreach (XmlNode xmlACENode in xmlACLNode.SelectNodes("ace"))
                                {
                                    if (xmlACENode.Attributes["role"] != null)
                                    {
                                        // Role Ace
                                        control.DefaultAccessControlList.Add(Filter, new AccessControlEntry(xmlACENode.Attributes["role"].Value,
                                                                                                            xmlACENode.Attributes["action"].Value, bool.Parse(xmlACENode.Attributes["allow"].Value)));
                                    }
                                    else
                                    {
                                        // Principal Ace
                                        control.DefaultAccessControlList.Add(Filter, new AccessControlEntry(int.Parse(xmlACENode.Attributes["principalid"].Value),
                                                                                                            xmlACENode.Attributes["action"].Value, bool.Parse(xmlACENode.Attributes["allow"].Value)));
                                    }
                                }
                            }

                            container.Controls.Add(control);
                        }
                    }

                    cnfg.Containers.Add(container);
                }
            }

            return(cnfg);
        }
Пример #7
0
        /// <summary>
        /// Inits the specified owner.
        /// </summary>
        /// <param name="owner">The owner.</param>
        /// <param name="controlInfo">The control info.</param>
        public void Init(IIbnContainer owner, IbnControlInfo controlInfo)
        {
            _ownerContainer = owner;

            _info = controlInfo;

            using (IDataReader reader = DBDirectory.GetRoot(CurrentTimeZoneId, owner.Key))
            {
                if (reader.Read())
                    _root = new DirectoryInfo(this, reader);
            }

            if (_root == null)
            {
                using (IDataReader reader = DBDirectory.CreateRoot(CurrentTimeZoneId, owner.Key, "root", this.CurrentUserId, DateTime.Now))
                {
                    if (reader.Read())
                    {
                        _root = new DirectoryInfo(this, reader);
                    }
                }

                AccessControlList rootAcl = AccessControlList.GetACL(_root.Id);

                foreach (AccessControlEntry ace in _info.DefaultAccessControlList.GetACL(_ownerContainer.Key))
                    rootAcl.Add(ace);

                if (rootAcl.Count > 0)
                    AccessControlList.SetACL(this, rootAcl, false);
            }
        }
Пример #8
0
 /// <summary>
 /// Inits the specified owner.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="controlInfo">The control info.</param>
 public void Init(IIbnContainer owner, IbnControlInfo controlInfo)
 {
     _ownerContainer = owner;
     //_containerKey = owner.Key;
     _info =  controlInfo;
 }
Пример #9
0
 public void Add(IbnControlInfo item)
 {
     this.InnerHashtable.Add(item.Name, item);
 }
Пример #10
0
 public void Init(IIbnContainer owner, IbnControlInfo controlInfo)
 {
     _ownerContainer = owner;
     _info =  controlInfo;
 }