Page 1 of 1

Do you have an easy way to set only R,W,M,D,RE permissions?

Posted: Thu Jul 15, 2010 1:04 pm
by dunion
If I set Read/Write it sets 'Full' which we don't want.
I'm using Set Read Write Permissions on File System Object "..." for "..."

I don't want to install and call xacls, obviously I could write it in code and run some custom code but I was thinking this was a common enough operation there may be some built in function for it.

Re: Do you have an easy way to set only R,W,M,D,RE permissio

Posted: Fri Jul 16, 2010 7:18 pm
by mills
Take a look at the Access Control section under Design/Advanced Options:
Access_Control.jpg
Access_Control.jpg (205.26 KiB) Viewed 4050 times

Re: Do you have an easy way to set only R,W,M,D,RE permissio

Posted: Wed Jul 28, 2010 8:03 am
by dunion
That's where I started but the options are read, write or full and putting read, write (but not full) still end up with full.
What I need is explicitly 'everyting but Full and Special'
What I tried is to run a bit of code to do the following

DirectoryInfo di = new DirectoryInfo(path);
DirectorySecurity ds = di.GetAccessControl();
Then I remove inherited permissions and set permissions via.
ds.AddAccessRule(new FileSystemAccessRule(...)) - add explicit permissions.
di.SetAccessControl(ds);
And a few variants

This works on Vista - the problem on a clean Win7 system in the ProgramData area (where I need to grant rights) the user doesn't have ownership, so the GetAccessControl() fails unless I take ownership in code, which I don't necessarily want to do....

Re: Do you have an easy way to set only R,W,M,D,RE permissio

Posted: Mon Aug 09, 2010 3:31 pm
by mills
IA doesn't have permission capabilities beyond what I previously mentioned. I did find a link that might have some code samples that might help you:
http://www.debugging.com/bug/1522

This link really caught my attention:
http://www.codeproject.com/dotnet/NTSecurityNET.asp