public static string GetContentACL(IContent content) { var accessControlList = new List <string>(); IContentSecurable contentSecurable = content as IContentSecurable; IContentSecurityDescriptor securityDescriptor = contentSecurable.GetContentSecurityDescriptor(); foreach (AccessControlEntry accessControlEntry in securityDescriptor.Entries) { if ((accessControlEntry.Access & AccessLevel.Read) == AccessLevel.Read) { accessControlList.Add(string.Format("{0}:{1}", accessControlEntry.EntityType == SecurityEntityType.User ? "U" : "G", accessControlEntry.Name)); } } return(string.Join("|", accessControlList)); }
private static IEnumerable <string> SecurityEntityWithReadAccess(this IContentSecurable contentSecurable, SecurityEntityType securityEntityType) { ObjectExtensions.ValidateNotNullArgument((object)contentSecurable, "contentSecurable"); return((IEnumerable <string>)Enumerable.ToArray <string>(Enumerable.Select <AccessControlEntry, string>(Enumerable.Where <AccessControlEntry>(contentSecurable.GetContentSecurityDescriptor().Entries, (Func <AccessControlEntry, bool>)(x => { if (x.EntityType == securityEntityType) { return (x.Access & AccessLevel.Read) == AccessLevel.Read; } else { return false; } })), (Func <AccessControlEntry, string>)(x => x.Name)))); }