Hey guys, I am writing an application that retrieves the Group Names and access permissions for each NT group populated from the foreach loop. In addition, I have included a DataGridView control where each cell has a checkbox column, the application is going to check each cell accordingly e.g Read, Write, Modify, etc for each group. I can not for the life of me, figure out how to check these boxes accordingly. The code snippet below demonstrates what I am trying to do with a standard DataGridView control textbox column, but I would like to make these checkboxes rather than textboxes. Any feedback would be greatly appreciated. In the code snippet be below Property is the path that is passed in from another method.
private void CheckDirPermissions(ResultProperty Property)
{
if (Property.Type == typeof(string) && !Property.IsArray)
{
try
{
FileSecurity folderSecurity = File.GetAccessControl(Property.String);
foreach (FileSystemAccessRule fileSystemAccessRule in folderSecurity.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount)))
{
string IdentityReference = fileSystemAccessRule.IdentityReference.ToString();
string AccessControlType = fileSystemAccessRule.AccessControlType.ToString();
string filesystemrights = fileSystemAccessRule.FileSystemRights.ToString();
string IsInherited = fileSystemAccessRule.IsInherited.ToString();
DataGridDirPermissions.Rows.Add(IdentityReference,
filesystemrights,
AccessControlType,
IsInherited);
}
}
catch (Exception)
{
MessageBox.Show("Path does not exist.", "Path Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else return;
}