[python-win32] Re: Folder Permissions - Inherit problem

Roger Upole rwupole at msn.com
Tue Mar 28 22:26:31 CEST 2006


Dennis Feiock wrote:

> When I tested using AddAccessAllowedAceEx on a folder, I noticed that the existing subfolders that have inheritance enabled do
> not automatically take on the added permission.  When creating a new folder, it added the ACE as it should.  Any suggestions?
> Here is the code I used (note: I couldn't find information on the SetDacl options, so that might be it):
...
>>> win32security.SetFileSecurity(fullpath,win32security.DACL_SECURITY_INFORMATION,sd1)

Try using SetNamedSecurityInfo instead. I think SetFileSecurity is actually considered
obsolete now.
After playing around with both of these, it appears SetNamedSecurityInfo will
cause the inherited ACEs to propagate to existing subfolders, whereas SetFileSecurity doesn't.

win32security.SetNamedSecurityInfo(fullpath, win32security.SE_FILE_OBJECT,
        win32security.DACL_SECURITY_INFORMATION,None, None, dacl1, None)

        hth
            Roger





More information about the Python-win32 mailing list