S
SimeonArgus
I'm writing an app that manages who has access to our internal files.
It does this by assigning certain groups to specific access. It works
great... except...
The permissions are all marked as "Special" permissions. This means
that under the general "Scurity" tab (without going into Advanced"),
all boxes for the specified users are unchecked. To make matters
worse, if I use the Microsoft-suggested way of setting permissions,
then all checkboxes become blank for all users, unless you view the
user settings in the advanced page.
Let me reiterate... the permissions themselves are accurate. But I
can't see the permissions that are set (even if I have FullControl)
without going into the Advanced page.
The code is utterly simple (which may be my problem). Any suggestions
on how to set the appropriate rights and still be able to view the
permissions in the general "security" tab??
<blockquote><pre> public void SetSecurity(string dirName,
string account,
FileSystemRights rights, AccessControlType controlType)
{
try
{
DirectorySecurity dSecurity =
Directory.GetAccessControl(dirName);
dSecurity.AddAccessRule(new FileSystemAccessRule
(account, rights, controlType));
Directory.SetAccessControl(dirName, dSecurity);
}
catch
{
txtStatus.Text += "Unable to add " + rights.ToString()
+ " from " +
dirName + " for " + account + "\r\n";
}
}</pre></blockquote>
It does this by assigning certain groups to specific access. It works
great... except...
The permissions are all marked as "Special" permissions. This means
that under the general "Scurity" tab (without going into Advanced"),
all boxes for the specified users are unchecked. To make matters
worse, if I use the Microsoft-suggested way of setting permissions,
then all checkboxes become blank for all users, unless you view the
user settings in the advanced page.
Let me reiterate... the permissions themselves are accurate. But I
can't see the permissions that are set (even if I have FullControl)
without going into the Advanced page.
The code is utterly simple (which may be my problem). Any suggestions
on how to set the appropriate rights and still be able to view the
permissions in the general "security" tab??
<blockquote><pre> public void SetSecurity(string dirName,
string account,
FileSystemRights rights, AccessControlType controlType)
{
try
{
DirectorySecurity dSecurity =
Directory.GetAccessControl(dirName);
dSecurity.AddAccessRule(new FileSystemAccessRule
(account, rights, controlType));
Directory.SetAccessControl(dirName, dSecurity);
}
catch
{
txtStatus.Text += "Unable to add " + rights.ToString()
+ " from " +
dirName + " for " + account + "\r\n";
}
}</pre></blockquote>