API Reference
AclPermissions
High-level helpers to Add/Remove/Set permissions for File, Registry, and Service objects. Thin wrappers over AclQuery* and AclWriter* with sensible merge/replace semantics.
Inheritance
- Object
- AclPermissions
Methods
public static Boolean AddFileAllow(String path, String identity, FileSystemRights rights, AclInheritanceFlags inheritance = None) #BooleanAdds an Allow ACE for a file or directory (merge semantics).
Parameters
- path System.String
- identity System.String
- rights System.Security.AccessControl.FileSystemRights
- inheritance ComputerX.Acl.AclInheritanceFlags = None
Examples
AclPermissions.AddFileAllow(@"C:\\Data", @"DOMAIN\\Ops", FileSystemRights.Modify, AclInheritanceFlags.ContainerInherit|AclInheritanceFlags.ObjectInherit);
public static Boolean AddFileDeny(String path, String identity, FileSystemRights rights, AclInheritanceFlags inheritance = None) #BooleanAdds a Deny ACE for a file or directory (merge semantics).
Parameters
- path System.String
- identity System.String
- rights System.Security.AccessControl.FileSystemRights
- inheritance ComputerX.Acl.AclInheritanceFlags = None
public static Boolean AddFilePermission(String path, IEnumerable<String> identities, FileSystemRights rights, AclAccessType type = Allow, AclInheritanceFlags inheritance = None) #BooleanAdds an ACE to a file or directory. Merge semantics (existing rights for the same identity/type are unioned).
Parameters
- arg1 System.String
- arg2 System.String
- arg3 System.Security.AccessControl.FileSystemRights
- arg4 ComputerX.Acl.AclAccessType = Allow
- arg5 ComputerX.Acl.AclInheritanceFlags = None
AddFilePermission(System.String path, System.Collections.Generic.IEnumerable{System.String} identities, System.Security.AccessControl.FileSystemRights rights, ComputerX.Acl.AclAccessType type, ComputerX.Acl.AclInheritanceFlags inheritance) #Adds an ACE to a file or directory for multiple identities using merge semantics.
Parameters
- path System.String
- Target file or directory path.
- identities System.Collections.Generic.IEnumerable{System.String}
- Account names or SIDs.
- rights System.Security.AccessControl.FileSystemRights
- File system rights to grant or deny.
- type ComputerX.Acl.AclAccessType
- Allow or Deny.
- inheritance ComputerX.Acl.AclInheritanceFlags
- Inheritance flags applied to the ACE.
public static Boolean AddRegistryAllow(String computer, String keyPath, String identity, RegistryRights rights) #BooleanAdds an Allow ACE to a registry key (merge semantics).
Parameters
- computer System.String
- keyPath System.String
- identity System.String
- rights System.Security.AccessControl.RegistryRights
public static Boolean AddRegistryDeny(String computer, String keyPath, String identity, RegistryRights rights) #BooleanAdds a Deny ACE to a registry key (merge semantics).
Parameters
- computer System.String
- keyPath System.String
- identity System.String
- rights System.Security.AccessControl.RegistryRights
public static Boolean AddRegistryPermission(String computer, String keyPath, IEnumerable<String> identities, RegistryRights rights, AclAccessType type = Allow) #BooleanAdds an ACE to a registry key for a single identity (merge semantics).
Parameters
- computer System.String
- Computer name (null/empty for local machine).
- keyPath System.String
- Full registry path (e.g., HKLM\SYSTEM\...).
- identity System.String
- Account name or SID.
- rights System.Security.AccessControl.RegistryRights
- Registry rights to grant or deny.
- type ComputerX.Acl.AclAccessType = Allow
- Allow or Deny.
AddRegistryPermission(System.String arg1, System.String arg2, System.Collections.Generic.IEnumerable{System.String} arg3, System.Security.AccessControl.RegistryRights arg4, ComputerX.Acl.AclAccessType arg5) #Adds an ACE to a registry key for multiple identities (merge semantics).
Parameters
- arg1 System.String
- arg2 System.String
- arg3 System.Collections.Generic.IEnumerable{System.String}
- arg4 System.Security.AccessControl.RegistryRights
- arg5 ComputerX.Acl.AclAccessType
public static Boolean AddServiceAllow(String computer, String serviceName, String identity, ServiceRights rights) #BooleanAdds an Allow ACE to a service DACL (merge semantics).
Parameters
- computer System.String
- serviceName System.String
- identity System.String
- rights ComputerX.Acl.ServiceRights
public static Boolean AddServiceDeny(String computer, String serviceName, String identity, ServiceRights rights) #BooleanAdds a Deny ACE to a service DACL (merge semantics).
Parameters
- computer System.String
- serviceName System.String
- identity System.String
- rights ComputerX.Acl.ServiceRights
public static Boolean AddServicePermission(String computer, String serviceName, IEnumerable<String> identities, ServiceRights rights, AclAccessType type = Allow) #BooleanAdds an ACE to a service DACL for a single identity (merge semantics).
Parameters
- computer System.String
- serviceName System.String
- identity System.String
- rights ComputerX.Acl.ServiceRights
- type ComputerX.Acl.AclAccessType = Allow
AddServicePermission(System.String computer, System.String serviceName, System.Collections.Generic.IEnumerable{System.String} identities, ComputerX.Acl.ServiceRights rights, ComputerX.Acl.AclAccessType type) #Adds an ACE to a service DACL for multiple identities (merge semantics).
Parameters
- computer System.String
- serviceName System.String
- identities System.Collections.Generic.IEnumerable{System.String}
- rights ComputerX.Acl.ServiceRights
- type ComputerX.Acl.AclAccessType
public static Boolean RemoveFilePermission(String path, IEnumerable<String> identities, FileSystemRights rights, AclAccessType type = Allow, Nullable<AclInheritanceFlags> matchInheritance = null) #BooleanRemoves specific rights for an identity from a file/directory DACL. When the remaining mask is non‑zero, the ACE is rewritten with the reduced mask.
Parameters
- path System.String
- Target file or directory.
- identity System.String
- Account name or SID.
- rights System.Security.AccessControl.FileSystemRights
- Rights mask to remove.
- type ComputerX.Acl.AclAccessType = Allow
- Allow or Deny ACE to target.
- matchInheritance System.Nullable{ComputerX.Acl.AclInheritanceFlags} = null
- Optional inheritance flags to match; when null, matches any.
RemoveFilePermission(System.String arg1, System.Collections.Generic.IEnumerable{System.String} arg2, System.Security.AccessControl.FileSystemRights arg3, ComputerX.Acl.AclAccessType arg4, System.Nullable{ComputerX.Acl.AclInheritanceFlags} arg5) #Removes rights for multiple identities from a file/directory DACL.
Parameters
- arg1 System.String
- arg2 System.Collections.Generic.IEnumerable{System.String}
- arg3 System.Security.AccessControl.FileSystemRights
- arg4 ComputerX.Acl.AclAccessType
- arg5 System.Nullable{ComputerX.Acl.AclInheritanceFlags}
public static Boolean RemoveRegistryPermission(String computer, String keyPath, IEnumerable<String> identities, RegistryRights rights, AclAccessType type = Allow) #BooleanRemoves specific rights for an identity from a registry key DACL.
Parameters
- arg1 System.String
- arg2 System.String
- arg3 System.String
- arg4 System.Security.AccessControl.RegistryRights
- arg5 ComputerX.Acl.AclAccessType = Allow
RemoveRegistryPermission(System.String arg1, System.String arg2, System.Collections.Generic.IEnumerable{System.String} arg3, System.Security.AccessControl.RegistryRights arg4, ComputerX.Acl.AclAccessType arg5) #Removes rights for multiple identities from a registry key DACL.
Parameters
- arg1 System.String
- arg2 System.String
- arg3 System.Collections.Generic.IEnumerable{System.String}
- arg4 System.Security.AccessControl.RegistryRights
- arg5 ComputerX.Acl.AclAccessType
public static Boolean RemoveServicePermission(String computer, String serviceName, IEnumerable<String> identities, ServiceRights rights, AclAccessType type = Allow) #BooleanRemoves specific rights for an identity from a service DACL.
Parameters
- computer System.String
- serviceName System.String
- identity System.String
- rights ComputerX.Acl.ServiceRights
- type ComputerX.Acl.AclAccessType = Allow
RemoveServicePermission(System.String computer, System.String serviceName, System.Collections.Generic.IEnumerable{System.String} identities, ComputerX.Acl.ServiceRights rights, ComputerX.Acl.AclAccessType type) #Removes rights for multiple identities from a service DACL.
Parameters
- computer System.String
- serviceName System.String
- identities System.Collections.Generic.IEnumerable{System.String}
- rights ComputerX.Acl.ServiceRights
- type ComputerX.Acl.AclAccessType
public static Boolean ResetFileToInherited(String path) #BooleanResets a file or directory to inherited permissions only (removes all explicit ACEs and disables DACL protection).
Parameters
- path System.String
public static Boolean SetFilePermission(String path, String identity, FileSystemRights rights, AclAccessType type = Allow, AclInheritanceFlags inheritance = None) #BooleanReplaces any existing ACE for an identity with the provided rights on a file/directory.
Parameters
- path System.String
- Target file or directory.
- identity System.String
- Account name or SID.
- rights System.Security.AccessControl.FileSystemRights
- Rights mask to apply.
- type ComputerX.Acl.AclAccessType = Allow
- Allow or Deny.
- inheritance ComputerX.Acl.AclInheritanceFlags = None
- Inheritance flags for the new ACE.
public static Boolean SetRegistryPermission(String computer, String keyPath, String identity, RegistryRights rights, AclAccessType type = Allow) #BooleanReplaces any existing ACE for an identity with the provided rights on a registry key.
Parameters
- computer System.String
- keyPath System.String
- identity System.String
- rights System.Security.AccessControl.RegistryRights
- type ComputerX.Acl.AclAccessType = Allow
public static Boolean SetServicePermission(String computer, String serviceName, String identity, ServiceRights rights, AclAccessType type = Allow) #BooleanReplaces any existing ACE for an identity with the provided rights on a service DACL.
Parameters
- computer System.String
- serviceName System.String
- identity System.String
- rights ComputerX.Acl.ServiceRights
- type ComputerX.Acl.AclAccessType = Allow
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object