Re: Setting directory permissions (.NET)
- From: "dan artuso" <dartuso@xxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 3 Dec 2007 15:37:55 -0500
Hi Peter,
Does this snippet help?
Dim fi As New FileInfo("C:\msnlog.txt")
Dim fs As New FileSecurity
Dim obTypeToGet As Type
fs = fi.GetAccessControl()
obTypeToGet = Type.GetType("System.Security.Principal.NTAccount")
For Each ace As FileSystemAccessRule In fs.GetAccessRules(True, True,
obTypeToGet)
Debug.Print(ace.IdentityReference.Value)
Next
Now if only Joe could tell me why this returns an empty collection????
For Each aRule As FileSystemAuditRule In fs.GetAuditRules(True, True,
obTypeToGet)
Debug.Print(aRule.IdentityReference.Value)
Next
:-)
Dan
"Peter Bradley" <pbradley@xxxxxxxxxx> wrote in message
news:OW1LefcNIHA.6108@xxxxxxxxxxxxxxxxxxxxxxx
Peter Bradley wrote:
Joe Kaplan wrote:
I'm not sure the exact setting to recommend to you, but the technique I
usually use when doing this type of stuff is to take before and after
snapshots in code of the security descriptor and compare the differences
you got when you make the change you want in the UI. That technique
nearly always reveals the difference and the setting you need.
Joe K.
Thanks, Joe. I think I probably need a translation, but in the first
instance I'll talk to our admins who will probably have a better idea
than me.
If they need a translation as well, I'll get back to you if that's OK.
Thanks
Peter
Usual apologies for replying to self and for the double post in my last
reply (mea culpa).
Joe (or anyone else who's interested, of course), I tried to create a
program that would create a snapshot as you suggested, using the code in
your excellent book (pp302,303). I get stuck on the call to
GetAccessRules(), because I don't know how to get something I can pass as
the third parameter (presumable the sid for the folder???). Here's what I
have so far:
namespace Uwic.ACEList
{
class AceList
{
static void Main(string[] args)
{
DirectoryInfo dInfo = new
DirectoryInfo(@"C:\VisualStudio2005Projects\ACEListSolution\ACEList");
DirectorySecurity dSecurity = dInfo.GetAccessControl();
AuthorizationRuleCollection rules = null;
rules = dSecurity.GetAccessRules(true, true, typeof(?????));
}
}
}
.
- References:
- Setting directory permissions (.NET)
- From: Peter Bradley
- Re: Setting directory permissions (.NET)
- From: Joe Kaplan
- Re: Setting directory permissions (.NET)
- From: Peter Bradley
- Re: Setting directory permissions (.NET)
- From: Peter Bradley
- Setting directory permissions (.NET)
- Prev by Date: Re: Cannot write to event log when web application uses forms authentication
- Next by Date: Re: Setting directory permissions (.NET)
- Previous by thread: Re: Setting directory permissions (.NET)
- Next by thread: Re: Setting directory permissions (.NET)
- Index(es):
Relevant Pages
|