Discretionary Access Control List
(DACL) is meant for restricting/granting access to different resources at OS
Level to a particular user/group. And Security Access
Control Lists (SACL) allows you to audit different resource access
permissions.
DACL is collection of Access Control
Entries (ACE). RegistryRights, FileSystemRights etc. are the ACE
enumerations for their respective resources.
<Type>Security provides the
following Method:
(DACL)GetAccessRules,
(SACL)GetAuditRules,
[Add|Remove]AccessRule,
[Add|Remove]AuditRule.
Example:
public static void
AddFileSecurity(string fileName, string account,
FileSystemRights rights,
AccessControlType controlType)
{
// Get a FileSecurity object that represents the
// current security settings.
FileSecurity fSecurity = File.GetAccessControl(fileName);
// Add the FileSystemAccessRule to the security settings.
fSecurity.AddAccessRule(new FileSystemAccessRule(account,rights,
controlType));
// Set the new access settings.
File.SetAccessControl(fileName, fSecurity);
}
(DACL)GetAccessRules, (SACL)GetAuditRules return AuthorizationRuleCollection
which contain <Type>AccessRule or <Type>AuditRule.
Comments