Bugfixes..

- ModelsBuilder: Inject PublishedValueFallback into static Mixins
- ModelsBuilder: Throw exception if compiler can't compile the code
- CheckIfUserTicketDataIsStaleAttribute: Scope issue
- Ambiguous Actions: Couldn't determine the action when empty arrays was passed. Fixed by using more v8 like solution. (Still stupid the client not just have different endpoints)
- Fixed issue with reading the body from post requests. Often we where not allowed to seek in the stream.
- UmbracoHelper: Made available on UmbracoViewPage
- Client entity.resource.js: Don't ask server when getByIds has 0 ids.
- Client content.resource.js: Renamed endpoint GetEmptyBlueprint to avoid ambiguous action name
This commit is contained in:
Bjarke Berg
2021-01-29 10:30:28 +01:00
parent 04058fb9c6
commit 14284b64c2
27 changed files with 454 additions and 303 deletions

View File

@@ -45,6 +45,8 @@ namespace Umbraco.Web.BackOffice.Controllers
/// </summary>
[PluginController(Constants.Web.Mvc.BackOfficeApiArea)]
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocuments)]
[ParameterSwapControllerActionSelector(nameof(GetById), "id", typeof(int), typeof(Guid), typeof(Udi))]
[ParameterSwapControllerActionSelector(nameof(GetNiceUrl), "id", typeof(int), typeof(Guid), typeof(Udi))]
public class ContentController : ContentControllerBase
{
private readonly PropertyEditorCollection _propertyEditors;
@@ -332,7 +334,6 @@ namespace Umbraco.Web.BackOffice.Controllers
/// <returns></returns>
[OutgoingEditorModelEvent]
[Authorize(Policy = AuthorizationPolicies.ContentPermissionBrowseById)]
[DetermineAmbiguousActionByPassingParameters]
public ActionResult<ContentItemDisplay> GetById(int id)
{
var foundContent = GetObjectFromRequest(() => _contentService.GetById(id));
@@ -351,7 +352,6 @@ namespace Umbraco.Web.BackOffice.Controllers
/// <returns></returns>
[OutgoingEditorModelEvent]
[Authorize(Policy = AuthorizationPolicies.ContentPermissionBrowseById)]
[DetermineAmbiguousActionByPassingParameters]
public ActionResult<ContentItemDisplay> GetById(Guid id)
{
var foundContent = GetObjectFromRequest(() => _contentService.GetById(id));
@@ -371,7 +371,6 @@ namespace Umbraco.Web.BackOffice.Controllers
/// <returns></returns>
[OutgoingEditorModelEvent]
[Authorize(Policy = AuthorizationPolicies.ContentPermissionBrowseById)]
[DetermineAmbiguousActionByPassingParameters]
public ActionResult<ContentItemDisplay> GetById(Udi id)
{
var guidUdi = id as GuidUdi;
@@ -389,7 +388,6 @@ namespace Umbraco.Web.BackOffice.Controllers
/// <param name="contentTypeAlias"></param>
/// <param name="parentId"></param>
[OutgoingEditorModelEvent]
[DetermineAmbiguousActionByPassingParameters]
public ActionResult<ContentItemDisplay> GetEmpty(string contentTypeAlias, int parentId)
{
var contentType = _contentTypeService.Get(contentTypeAlias);
@@ -398,7 +396,7 @@ namespace Umbraco.Web.BackOffice.Controllers
return NotFound();
}
return GetEmpty(contentType, parentId);
return GetEmptyInner(contentType, parentId);
}
@@ -416,10 +414,10 @@ namespace Umbraco.Web.BackOffice.Controllers
return NotFound();
}
return GetEmpty(contentType, parentId);
return GetEmptyInner(contentType, parentId);
}
private ContentItemDisplay GetEmpty(IContentType contentType, int parentId)
private ContentItemDisplay GetEmptyInner(IContentType contentType, int parentId)
{
var emptyContent = _contentService.Create("", parentId, contentType.Alias, _backofficeSecurityAccessor.BackOfficeSecurity.GetUserId().ResultOr(0));
var mapped = MapToDisplay(emptyContent);
@@ -436,8 +434,7 @@ namespace Umbraco.Web.BackOffice.Controllers
}
[OutgoingEditorModelEvent]
[DetermineAmbiguousActionByPassingParameters]
public ActionResult<ContentItemDisplay> GetEmpty(int blueprintId, int parentId)
public ActionResult<ContentItemDisplay> GetEmptyBlueprint(int blueprintId, int parentId)
{
var blueprint = _contentService.GetBlueprintById(blueprintId);
if (blueprint == null)
@@ -462,7 +459,6 @@ namespace Umbraco.Web.BackOffice.Controllers
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[DetermineAmbiguousActionByPassingParameters]
public IActionResult GetNiceUrl(int id)
{
var url = _publishedUrlProvider.GetUrl(id);
@@ -474,7 +470,6 @@ namespace Umbraco.Web.BackOffice.Controllers
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[DetermineAmbiguousActionByPassingParameters]
public IActionResult GetNiceUrl(Guid id)
{
var url = _publishedUrlProvider.GetUrl(id);
@@ -486,7 +481,6 @@ namespace Umbraco.Web.BackOffice.Controllers
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[DetermineAmbiguousActionByPassingParameters]
public IActionResult GetNiceUrl(Udi id)
{
var guidUdi = id as GuidUdi;
@@ -504,7 +498,6 @@ namespace Umbraco.Web.BackOffice.Controllers
/// </summary>
/// <returns></returns>
[FilterAllowedOutgoingContent(typeof(IEnumerable<ContentItemBasic<ContentPropertyBasic>>), "Items")]
[DetermineAmbiguousActionByPassingParameters]
public PagedResult<ContentItemBasic<ContentPropertyBasic>> GetChildren(
int id,
string includeProperties,
@@ -1641,7 +1634,7 @@ namespace Umbraco.Web.BackOffice.Controllers
}
var toMoveResult = ValidateMoveOrCopy(move);
if (!(toMoveResult is null))
if (!(toMoveResult.Result is null))
{
return toMoveResult.Result;
}