Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure correct access to all manifests + introduce "public" package m…
…anifests (#15921) * Introduce "public" package manifests * Make sure "all manifests" are available to anyone with backoffice access * review comments
- Loading branch information
Showing
6 changed files
with
71 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/Umbraco.Cms.Api.Management/Controllers/Package/PublicPackageManifestController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Asp.Versioning; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Umbraco.Cms.Api.Management.ViewModels.Package; | ||
using Umbraco.Cms.Core.Manifest; | ||
using Umbraco.Cms.Core.Mapping; | ||
|
||
namespace Umbraco.Cms.Api.Management.Controllers.Package; | ||
|
||
[ApiVersion("1.0")] | ||
[AllowAnonymous] | ||
public class PublicPackageManifestController : PackageControllerBase | ||
{ | ||
private readonly IPackageManifestService _packageManifestService; | ||
private readonly IUmbracoMapper _umbracoMapper; | ||
|
||
public PublicPackageManifestController(IPackageManifestService packageManifestService, IUmbracoMapper umbracoMapper) | ||
{ | ||
_packageManifestService = packageManifestService; | ||
_umbracoMapper = umbracoMapper; | ||
} | ||
|
||
// NOTE: this endpoint is deliberately created as non-paginated to ensure the fastest possible client initialization | ||
[HttpGet("manifest/public")] | ||
[MapToApiVersion("1.0")] | ||
[ProducesResponseType(typeof(IEnumerable<PackageManifestResponseModel>), StatusCodes.Status200OK)] | ||
public async Task<IActionResult> PublicPackageManifests() | ||
{ | ||
PackageManifest[] packageManifests = (await _packageManifestService.GetPublicPackageManifestsAsync()).ToArray(); | ||
return Ok(_umbracoMapper.MapEnumerable<PackageManifest, PackageManifestResponseModel>(packageManifests)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters