تسجيل الدخول

مشاهدة النسخة كاملة : Directory Security



C# Programming
11-29-2009, 07:00 AM
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);