public static SetDirectorySecurity ( string dir, |
||
dir | string | |
Account | ||
Rights | FileSystemRights | |
ControlType | AccessControlType | |
Inherit | InheritanceFlags | |
Propagation | PropagationFlags | |
return | System.Boolean |
public static Boolean SetDirectorySecurity(string dir, IdentityReference[] Account, FileSystemRights Rights, AccessControlType ControlType, InheritanceFlags Inherit, PropagationFlags Propagation)
{
DirectoryInfo dInfo = new DirectoryInfo(dir);
DirectorySecurity dSecurity = dInfo.GetAccessControl();
try
{
foreach (IdentityReference account in Account)
{
dSecurity.AddAccessRule(new FileSystemAccessRule(account, Rights, Inherit, Propagation, ControlType));
}
dInfo.SetAccessControl(dSecurity);
}
catch (Exception ex)
{
LibraryLogging.Error("unable to SetDirectorySecurity for {0} error {1}", dir, ex.Message);
return false;
}
return true;
}
Security::SetDirectorySecurity ( string dir, string Account, FileSystemRights Rights, AccessControlType ControlType, InheritanceFlags Inherit, PropagationFlags Propagation ) : System.Boolean |