Slide 23
Slide 23 text
User rights Windows
security_descriptor = GetFileSecurity(path, DACL_SECURITY_INFORMATION)
dacl = ACL()
for group_sid, attributes in groups:
# set the attributes of the group only if not null
if attributes:
dacl.AddAccessAllowedAceEx(ACL_REVISION,
CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE, attributes,
group_sid)
# the dacl has all the info of the diff groups passed in the parameters
security_descriptor.SetSecurityDescriptorDacl(1, dacl, 0)
SetFileSecurity(path, DACL_SECURITY_INFORMATION, security_descriptor)
Programando Cross Platform
PyCon Argentina 2011