/// <summary>
        /// Adds the children to list.
        /// </summary>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
        private void AddChildren(User user, bool includeLinkedChildren, Dictionary <Guid, BaseItem> result, bool recursive, InternalItemsQuery query)
        {
            foreach (var child in GetEligibleChildrenForRecursiveChildren(user))
            {
                if (child.IsVisible(user))
                {
                    if (query == null || UserViewBuilder.FilterItem(child, query))
                    {
                        result[child.Id] = child;
                    }

                    if (recursive && child.IsFolder)
                    {
                        var folder = (Folder)child;

                        folder.AddChildren(user, includeLinkedChildren, result, true, query);
                    }
                }
            }

            if (includeLinkedChildren)
            {
                foreach (var child in GetLinkedChildren(user))
                {
                    if (child.IsVisible(user))
                    {
                        if (query == null || UserViewBuilder.FilterItem(child, query))
                        {
                            result[child.Id] = child;
                        }
                    }
                }
            }
        }
Exemple #2
0
        public override IEnumerable <BaseItem> GetRecursiveChildren(User user, InternalItemsQuery query)
        {
            var result = GetItems(new InternalItemsQuery
            {
                User      = user,
                Recursive = true,
                EnableTotalRecordCount = false,

                ForceDirect = true
            }).Result;

            return(result.Items.Where(i => UserViewBuilder.FilterItem(i, query)));
        }