/// <summary> /// Gets a DirectorySecurity object that encapsulates the specified type of access control list (ACL) entries for the directory described by the current DirectoryInfo object. /// </summary> /// <param name="includeSections">One of the AccessControlSections values that specifies the type of access control list (ACL) information to receive.</param> /// <returns>A DirectorySecurity object that encapsulates the access control rules for the file described by the path parameter.</returns> public System.Security.AccessControl.DirectorySecurity GetAccessControl(System.Security.AccessControl.AccessControlSections includeSections) { return(Directory.GetAccessControl(FullPath, includeSections)); }
private bool HasInheritedPermissions(string path) { var acl = Directory.GetAccessControl(path); return(acl.GetAccessRules(false, true, typeof(SecurityIdentifier)).Count > 0); }