Пример #1
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(owner.Key))
            {
                if (reader.Read())
                {
                    _root = new DirectoryInfo(this, reader);
                }
            }

            if (_root == null)
            {
                using (IDataReader reader = DBDirectory.CreateRoot(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);
                }
            }
        }