Try our conversational search powered by Generative AI!

Read IContent access rights programmatically

Vote:
 

Hello,

Has anyone a good code snippet on how to programmatically read the access rights set on an IContent object? I would use ACL if I was working with pages, but I need it for media and block content items.

Thanks,

/Marten

#113564
Nov 24, 2014 20:02
Vote:
 
ISecurable securable = content as ISecurable;
if (securable == null)
    return;
ISecurityDescriptor securityDescriptor = securable.GetSecurityDescriptor();

var rights = securityDescriptor.GetAccessLevel(user);
#113567
Nov 24, 2014 22:06
Vote:
 

Thank you, Valdis!

#113571
Nov 24, 2014 22:53
Vote:
 

For the googlers and very curious listeners:
I ended up using 

IContentSecurityDescriptorExtensions.ToRawACEArray(content)

instead, because I needed to do a role check in a filter. But I got on the right track with the provided answer.

/Marten

#113582
Nov 25, 2014 10:06
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.