How to set propogating folder permissions

delphi package - easy access to security apis

How to set propogating folder permissions

Postby Dr_Calculus » Mon Apr 07, 2008 5:27 pm

I am using madSecurity to set the file permissions on a folder I create to allow full access to everyone. I use the following code which works:

FileSecurity(Path).DAcl.Deallocate;

However the folder is used by a service which creates sub folders which need the same permissions but they are being created with restricted permissions. I do not know what folders will be created. I need to set the permission of the top folder so that it propogates to any sub folders.

Is there a simple way to do this?

Many thanks.
Dr_Calculus
 
Posts: 2
Joined: Mon Apr 07, 2008 5:14 pm

Postby Dr_Calculus » Tue Apr 08, 2008 10:37 am

I finally managed to work it out. In case it helps any other newbies the code that works for me is:

Code: Select all
With FileSecurity(DPath).DACL do
begin
        Clear;
        NewItem(Everyone, GENERIC_ALL, atAllowed, [afObjectInherit, afContainerInherit]);
end;
Dr_Calculus
 
Posts: 2
Joined: Mon Apr 07, 2008 5:14 pm


Return to madSecurity

Who is online

Users browsing this forum: No registered users and 1 guest