Change ACL for MediaData

Vote:
 

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?

#90937
Sep 22, 2014 16:19
Vote:
 

var writableSecurityDescriptor = (mediaData as IContentSecurable).GetContentSecurityDescriptor().CreateWritableClone() as IContentSecurityDescriptor;

//Do your modifications here

ServiceLocator.Current.GetInstance().Save(contentLink, writableSecurityDescriptor, SecuritySaveType.Replace);

#90961
Sep 23, 2014 10:11
Vote:
 

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.

Cheers ;)

#122391
Jun 01, 2015 16:35
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.