var writableSecurityDescriptor = (mediaData as IContentSecurable).GetContentSecurityDescriptor().CreateWritableClone() as IContentSecurityDescriptor;
//Do your modifications here
Minor correction to Johans post; the last line should read:
ServiceLocator.Current.GetInstance<IContentSecurityRepository>().Save(contentLink, writableSecurityDescriptor, SecuritySaveType.Replace);
.. where <IContentSecurityRepository> is the Service we are using.
How can I change the acl for MediaData? When changing the acl for PageData I use page.ACL.CreateWritebleClone(), but MediaData doesn't expose an ACL-property. I've tried to create a ContentAccessControlList from the contentLink but an exception is thrown when I try to save it. How can this be done?