It should be as easy as
var ctrl = new DirectoryInfo(@"D:\something").GetAccessControl();
var everyone = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
var accessRules = ctrl.GetAccessRules(true, true, typeof(SecurityIdentifier));
var result = accessRules
.Cast<FileSystemAccessRule>()
.Any(rule =>
rule.IdentityReference.Value == everyone.Value && // check everyone
rule.AccessControlType == AccessControlType.Allow && // check allow
rule.FileSystemRights == FileSystemRights.FullControl); // check full control
Note : This is windows only (obviously), and you might need System.IO.FileSystem.AccessControl
nuget
Additional Resources
Directory.GetAccessControl Method
Returns the Windows access control list (ACL) for a directory.
Represents a security identifier (SID) and provides marshaling and comparison operations for SIDs.
Indicates a SID that matches everyone.
DirectoryObjectSecurity.GetAccessRules(Boolean, Boolean, Type) Method
Gets a collection of the access rules associated with the specified security identifier.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.