mirror of
https://github.com/bitwarden/server
synced 2025-12-22 11:13:27 +00:00
36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using Bit.Api.AdminConsole.Authorization;
|
|
using Bit.Api.AdminConsole.Authorization.Requirements;
|
|
using Bit.Api.Billing.Attributes;
|
|
using Bit.Core;
|
|
using Bit.Core.AdminConsole.Entities;
|
|
using Bit.Core.Billing.Organizations.Queries;
|
|
using Bit.Core.Utilities;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|
|
|
namespace Bit.Api.Billing.Controllers.VNext;
|
|
|
|
[Authorize("Application")]
|
|
[Route("organizations/{organizationId:guid}/billing/vnext/self-host")]
|
|
[SelfHosted(SelfHostedOnly = true)]
|
|
public class SelfHostedOrganizationBillingVNextController(
|
|
IGetOrganizationMetadataQuery getOrganizationMetadataQuery) : BaseBillingController
|
|
{
|
|
[Authorize<MemberOrProviderRequirement>]
|
|
[HttpGet("metadata")]
|
|
[RequireFeature(FeatureFlagKeys.PM25379_UseNewOrganizationMetadataStructure)]
|
|
[InjectOrganization]
|
|
public async Task<IResult> GetMetadataAsync([BindNever] Organization organization)
|
|
{
|
|
var metadata = await getOrganizationMetadataQuery.Run(organization);
|
|
|
|
if (metadata == null)
|
|
{
|
|
return TypedResults.NotFound();
|
|
}
|
|
|
|
return TypedResults.Ok(metadata);
|
|
}
|
|
}
|