diff --git a/src/Umbraco.Web/Controllers/TagsController.cs b/src/Umbraco.Web/Controllers/TagsController.cs deleted file mode 100644 index b65d4de531..0000000000 --- a/src/Umbraco.Web/Controllers/TagsController.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Core; -using Umbraco.Core.Cache; -using Umbraco.Core.Configuration; -using Umbraco.Core.Logging; -using Umbraco.Core.Persistence; -using Umbraco.Core.Services; -using Umbraco.Web.Models; -using Umbraco.Web.WebApi; - -namespace Umbraco.Web.Controllers -{ - /// - /// A public web service for querying tags - /// - /// - /// This controller does not contain methods to query for content, media or members based on tags, those methods would require - /// authentication and should not be exposed publicly. - /// - // TODO: This controller should be moved to a more suitable place. - public class TagsController : UmbracoApiController - { - public TagsController() - { - } - - public TagsController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper) - : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper) - { - } - - /// - /// Get every tag stored in the database (with optional group) - /// - public IEnumerable GetAllTags(string group = null) - { - return Umbraco.TagQuery.GetAllTags(group); - } - - /// - /// Get all tags for content items (with optional group) - /// - /// - /// - public IEnumerable GetAllContentTags(string group = null) - { - return Umbraco.TagQuery.GetAllContentTags(group); - } - - /// - /// Get all tags for media items (with optional group) - /// - /// - /// - public IEnumerable GetAllMediaTags(string group = null) - { - return Umbraco.TagQuery.GetAllMediaTags(group); - } - - /// - /// Get all tags for member items (with optional group) - /// - /// - /// - public IEnumerable GetAllMemberTags(string group = null) - { - return Umbraco.TagQuery.GetAllMemberTags(group); - } - - /// - /// Returns all tags attached to a property by entity id - /// - /// - /// - /// - /// - public IEnumerable GetTagsForProperty(int contentId, string propertyTypeAlias, string tagGroup = null) - { - return Umbraco.TagQuery.GetTagsForProperty(contentId, propertyTypeAlias, tagGroup); - } - - /// - /// Returns all tags attached to an entity (content, media or member) by entity id - /// - /// - /// - /// - public IEnumerable GetTagsForEntity(int contentId, string tagGroup = null) - { - return Umbraco.TagQuery.GetTagsForEntity(contentId, tagGroup); - } - - } -} diff --git a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs index 6b6cfacacc..58f49f4261 100644 --- a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs +++ b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs @@ -238,10 +238,6 @@ namespace Umbraco.Web.Editors "updateCheckApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( controller => controller.GetCheck()) }, - { - "tagApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( - controller => controller.GetAllTags(null)) - }, { "templateApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( controller => controller.GetById(0)) diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs index 573bb2b872..1fa7575d67 100644 --- a/src/Umbraco.Web/Editors/EntityController.cs +++ b/src/Umbraco.Web/Editors/EntityController.cs @@ -422,16 +422,7 @@ namespace Umbraco.Web.Editors { //TODO: Need to check for Object types that support hierarchy here, some might not. - int[] startNodes = null; - switch (type) - { - case UmbracoEntityTypes.Document: - startNodes = Security.CurrentUser.CalculateContentStartNodeIds(Services.EntityService); - break; - case UmbracoEntityTypes.Media: - startNodes = Security.CurrentUser.CalculateMediaStartNodeIds(Services.EntityService); - break; - } + var startNodes = GetStartNodes(type); var ignoreUserStartNodes = IsDataTypeIgnoringUserStartNodes(dataTypeId); @@ -556,16 +547,7 @@ namespace Umbraco.Web.Editors IEnumerable entities; long totalRecords; - int[] startNodes = null; - switch (type) - { - case UmbracoEntityTypes.Document: - startNodes = Security.CurrentUser.CalculateContentStartNodeIds(Services.EntityService); - break; - case UmbracoEntityTypes.Media: - startNodes = Security.CurrentUser.CalculateMediaStartNodeIds(Services.EntityService); - break; - } + var startNodes = GetStartNodes(type); var ignoreUserStartNodes = IsDataTypeIgnoringUserStartNodes(dataTypeId); @@ -630,6 +612,20 @@ namespace Umbraco.Web.Editors } } + private int[] GetStartNodes(UmbracoEntityTypes type) + { + switch (type) + { + case UmbracoEntityTypes.Document: + return Security.CurrentUser.CalculateContentStartNodeIds(Services.EntityService); + case UmbracoEntityTypes.Media: + return Security.CurrentUser.CalculateMediaStartNodeIds(Services.EntityService); + default: + return new int[0]; + } + + } + public PagedResult GetPagedDescendants( int id, @@ -656,16 +652,7 @@ namespace Umbraco.Web.Editors { // root is special: we reduce it to start nodes - int[] aids = null; - switch (type) - { - case UmbracoEntityTypes.Document: - aids = Security.CurrentUser.CalculateContentStartNodeIds(Services.EntityService); - break; - case UmbracoEntityTypes.Media: - aids = Security.CurrentUser.CalculateMediaStartNodeIds(Services.EntityService); - break; - } + int[] aids = GetStartNodes(type); var ignoreUserStartNodes = IsDataTypeIgnoringUserStartNodes(dataTypeId); entities = aids == null || aids.Contains(Constants.System.Root) || ignoreUserStartNodes diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index db4a0f4a22..34510a2a72 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -1172,7 +1172,6 @@ True Reference.map -