Directory Security
-
Hi guys im creating a folder then adding a user with permissions to that folder but how do I then set this security permission to apply to this folder, sub folders and files within this folder? currently it just applys to this folder only.(so when the app creates a file within this folder the file does not inherit the permission's from the folder)
DirectorySecurity dirSec = Directory.GetAccessControl(_dbPath);
dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.Write, AccessControlType.Allow));
dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.ReadAndExecute, AccessControlType.Allow));
dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.CreateFiles, AccessControlType.Allow));
dirSec.AddAccessRule(new FileSystemAccessRule(IdentityReference, FileSystemRights.WriteData,InheritanceLevel,PropagationFlags., AccessControlType.Allow));
Directory.SetAccessControl(_dbPath, dirSec); -
Hi guys im creating a folder then adding a user with permissions to that folder but how do I then set this security permission to apply to this folder, sub folders and files within this folder? currently it just applys to this folder only.(so when the app creates a file within this folder the file does not inherit the permission's from the folder)
DirectorySecurity dirSec = Directory.GetAccessControl(_dbPath);
dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.Write, AccessControlType.Allow));
dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.ReadAndExecute, AccessControlType.Allow));
dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.CreateFiles, AccessControlType.Allow));
dirSec.AddAccessRule(new FileSystemAccessRule(IdentityReference, FileSystemRights.WriteData,InheritanceLevel,PropagationFlags., AccessControlType.Allow));
Directory.SetAccessControl(_dbPath, dirSec);try this:
dirSec.AddAccessRule(new FileSystemAccessRule(IdentityReference, FileSystemRights.WriteData,
InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow));Edit: Splitted message, because it isn't rendered correctly
modified on Saturday, November 28, 2009 5:23 AM