/// <summary> /// Converts a System.Security.AccessControl.AccessControlType to a Opc.Ua.Configuration.AccessControlType /// </summary> public static AccessControlType Convert(System.Security.AccessControl.AccessControlType input) { if (input == System.Security.AccessControl.AccessControlType.Deny) { return(AccessControlType.Deny); } return(AccessControlType.Allow); }
public static void AddDirectorySecurity(string strPath, string Account, System.Security.AccessControl.FileSystemRights Rights, System.Security.AccessControl.AccessControlType ControlType) { System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(strPath); System.Security.AccessControl.DirectorySecurity accessControl = directoryInfo.GetAccessControl(); accessControl.AddAccessRule(new System.Security.AccessControl.FileSystemAccessRule(Account, Rights, ControlType)); directoryInfo.SetAccessControl(accessControl); }
public static void AddFileSecurity(string path, string Account, System.Security.AccessControl.FileSystemRights Rights, System.Security.AccessControl.AccessControlType ControlType) { System.IO.FileInfo FINFO = new System.IO.FileInfo(path); System.Security.AccessControl.FileSecurity FSECURITY = FINFO.GetAccessControl(); FSECURITY.AddAccessRule(new System.Security.AccessControl.FileSystemAccessRule(Account, Rights, ControlType)); FINFO.SetAccessControl(FSECURITY); }