Пример #1
0
        /// <summary>
        /// Turns the on is inherited.
        /// </summary>
        public void TurnOnIsInherited()
        {
            using (IDataReader fileReader = DBDirectory.GetById(this.OwnerDirectoryId))
            {
                if (fileReader.Read())
                {
                    int ParentDirectoryId = (int)fileReader["ParentDirectoryId"];

                    using (IDataReader aclReader = DBAccessControlList.GetAcl(ParentDirectoryId))
                    {
                        while (aclReader.Read())
                        {
                            this.Add(AccessControlEntry.InternalCreate((int)aclReader["AceId"],
                                                                       true,
                                                                       (string)SqlHelper.DBNull2Null(aclReader["role"]),
                                                                       (int)SqlHelper.DBNull2Null(aclReader["principalId"], 0),
                                                                       (string)SqlHelper.DBNull2Null(aclReader["action"]),
                                                                       (bool)(((byte)SqlHelper.DBNull2Null(aclReader["allow"])) == 1),
                                                                       false));
                        }
                    }
                }
            }

            _isInherited = true;
            SetChanged();
        }
Пример #2
0
 internal static DirectoryInfo InnerGetDirectory(int DirectoryId)
 {
     using (IDataReader reader = DBDirectory.GetById(DirectoryId))
     {
         if (reader.Read())
         {
             return(new DirectoryInfo(null, reader));
         }
         else
         {
             return(null);
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Gets the directory.
 /// </summary>
 /// <param name="DirectoryId">The directory id.</param>
 /// <returns></returns>
 public DirectoryInfo GetDirectory(int DirectoryId)
 {
     using (IDataReader reader = DBDirectory.GetById(DirectoryId))
     {
         if (reader.Read())
         {
             return(new DirectoryInfo(this, reader));
         }
         else
         {
             return(null);
         }
     }
 }
Пример #4
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);
                }
            }
        }