Hi all,

Is there anyway to do "Replace all child object permissions with
inheritable permissions from this object" programatically using PyWin32. I
found out that this resets the permissions for all the sub-folders and
files deep-down even though the permissions are set separately.

def remove_permission(path):
    sd = win32security.GetFileSecurity(path,
win32security.DACL_SECURITY_INFORMATION)
    dacl = sd.GetSecurityDescriptorDacl()   # instead of dacl =
win32security.ACL()
    win32security.SetNamedSecurityInfo(path, win32security.SE_FILE_OBJECT,
win32security.DACL_SECURITY_INFORMATION |
win32security.UNPROTECTED_DACL_SECURITY_INFORMATION, None, None, dacl, None)

I tried this on a folder. But didn't work.
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to