[python-win32] Replace all child permissions

mc at mclaveau mc at mclaveau
Mon Mar 20 12:52:02 EDT 2017


Le 20.03.17 à 16:13, Goku Balu a écrit :
> 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 at python.org
> https://mail.python.org/mailman/listinfo/python-win32
Hi!

You can call the Windows's command*  CACLS *(in command line).

@+
-- 
Michel Claveau


-- 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20170320/b014b439/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sign-styloplume.GIF
Type: image/gif
Size: 9129 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-win32/attachments/20170320/b014b439/attachment.gif>


More information about the python-win32 mailing list