mirror of
https://github.com/bitwarden/server
synced 2025-12-18 17:23:28 +00:00
[AC-434] Hide Billing screen for Reseller clients (#2783)
* [AC-434] Added ProviderType to ProfileOrganizationResponseModel * [AC-434] Migration script * [AC-434] Fixed indentation on migration script * [AC-434] Hiding sensitive subscription data if the user does not have permissions * [AC-434] Fixed missing dependency in unit test * [AC-434] Altered BillingSubscription.Amount and BillingSubscriptionUpcomingInvoice.Amount to nullable * [AC-434] Replaced CurrentContext.ManageBilling with ViewBillingHistory, ViewSubscription, EditSubscription and EditPaymentMethods * [AC-434] Reverted change on BillingSubscription.Amount and now setting Subscription.Items = null when User does not have permission * [AC-434] Added ProviderOrganizationProviderDetails_ReadByUserId * [AC-434] Added IProviderOrganizationRepository.GetManyByUserAsync * [AC-434] Added CurrentContext.GetOrganizationProviderDetails * [AC-434] Remove unneeded join Organization table
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using Bit.Core.Models.Data;
|
||||
|
||||
namespace Bit.Infrastructure.EntityFramework.Repositories.Queries;
|
||||
|
||||
public class ProviderOrganizationReadByUserIdQuery : IQuery<ProviderOrganizationProviderDetails>
|
||||
{
|
||||
private readonly Guid _userId;
|
||||
|
||||
public ProviderOrganizationReadByUserIdQuery(Guid userId)
|
||||
{
|
||||
_userId = userId;
|
||||
}
|
||||
|
||||
public IQueryable<ProviderOrganizationProviderDetails> Run(DatabaseContext dbContext)
|
||||
{
|
||||
var query = from po in dbContext.ProviderOrganizations
|
||||
join ou in dbContext.OrganizationUsers
|
||||
on po.OrganizationId equals ou.OrganizationId
|
||||
join p in dbContext.Providers
|
||||
on po.ProviderId equals p.Id
|
||||
where ou.UserId == _userId
|
||||
select new ProviderOrganizationProviderDetails
|
||||
{
|
||||
Id = po.Id,
|
||||
OrganizationId = po.OrganizationId,
|
||||
ProviderId = po.ProviderId,
|
||||
ProviderName = p.Name,
|
||||
ProviderType = p.Type
|
||||
};
|
||||
return query;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user