/// <summary> /// Gets allowed children of an item /// </summary> /// <param name="user">The user.</param> /// <param name="indexBy">The index by.</param> /// <returns>IEnumerable{BaseItem}.</returns> /// <exception cref="System.ArgumentNullException"></exception> public virtual IEnumerable <BaseItem> GetChildren(User user, string indexBy = null) { if (user == null) { throw new ArgumentNullException(); } //the true root should return our users root folder children if (IsPhysicalRoot) { return(user.RootFolder.GetChildren(user, indexBy)); } IEnumerable <BaseItem> result = null; if (!string.IsNullOrEmpty(indexBy)) { result = GetIndexedChildren(user, indexBy); } // If indexed is false or the indexing function is null if (result == null) { result = ActualChildren.Where(c => c.IsVisible(user)); } return(result); }
protected void RemoveChildrenInternal(IEnumerable <BaseItem> children) { var ids = children.Select(i => i.Id).ToList(); lock (_childrenSyncLock) { _children = ActualChildren.Where(i => !ids.Contains(i.Id)).ToList(); } }
public IEnumerable <BaseItem> GetHiddenChildren() { return(ActualChildren.Where(i => i.IsHidden)); }