/// <summary> /// Gets <see cref="Section"/>'s allowed by the current user and filtered by entities. /// </summary> /// <param name="entitySchema"><see cref="EntitySchema"/> instance.</param> /// <returns>Return <see cref="Section"/>'s allowed by the current user and filtered by entities.</returns> private IEnumerable <Section> GetSections(EntitySchema entitySchema) { var currentUserWorkplaces = GetCurrentUserWorkplaces(); LogInfoObjectList("Allowed workplaces", currentUserWorkplaces); var workplacesSectionsIds = GetWorkplacesSectionIds(currentUserWorkplaces); var sections = SectionManager.GetSectionsByEntityUId(entitySchema.UId); LogInfoObjectList($"Allowed schema '{entitySchema.Name}' sections", sections); var sectionType = GetSectionType(); return(sections.Where(s => workplacesSectionsIds.Contains(s.Id) && s.Type == sectionType)); }