mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
[AC-1081] Merge feature/billing-obfuscation (#5172)
* [AC-431] Add new organization invite process (#4841) * [AC-431] Added properties 'key' and 'keys' to OrganizationUserAcceptRequest * [AC-431] On organization accept added check for 'initOrganization' flag and send encrypt keys if true * [AC-431] Reverted changes on AcceptOrganizationComponent and OrganizationUserAcceptRequest * [AC-431] Created OrganizationUserAcceptInitRequest * [AC-431] Added method postOrganizationUserAcceptInit to OrganizationUserService * [AC-431] Created AcceptInitOrganizationComponent and added routing config. Added 'inviteInitAcceptedDesc' to messages * [AC-431] Remove blank line * [AC-431] Remove requirement for logging in again * [AC-431] Removed accept-init-organization.component.html * Update libs/common/src/abstractions/organization-user/organization-user.service.ts Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * [AC-431] Sending collection name when initializing an org * [AC-431] Deleted component accept-init-organization and incorporated logic into accept-organization * Update libs/common/src/abstractions/organization-user/organization-user.service.ts Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * [AC-431] Returning promise chains * [AC-431] Moved ReAuth check to org accept only * [AC-431] Fixed import issues --------- Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * [AC-434] Hide billing screen for reseller clients (#4955) * [AC-434] Retrieving ProviderType for each Org * [AC-434] Hide subscription details if user cannot manage billing * [AC-434] Renamed providerType to provider-type * [AC-434] Reverted change that showed Billing History and Payment Methods tabs * [AC-434] Hiding Secrets Manager enroll * [AC-434] Renamed Billing access variables to be more readable * Apply suggestions from code review Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * [AC-434] Reduce duplication in permission code * [AC-434] npm prettier * [AC-434] Changed selfhost subscription permission * [AC-434] Added canEditSubscription check for change plan buttons * [AC-434] Removed message displaying provider name in subscription * [AC-434] canEditSubscription logic depends on canViewSubscription * [AC-434] Hiding next charge value for users without billing edit permission * [AC-434] Changed canViewSubscription and canEditSubscription to be clearer * [AC-434] Altered BillingSubscriptionItemResponse.amount and BillingSubscriptionUpcomingInvoiceResponse.amount to nullable * [AC-434] Reverted change on BillingSubscriptionItemResponse.amount --------- Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * Updated IsPaidOrgGuard reference from org.CanManageBilling to canEditSubscription --------- Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { ListResponse } from "../../models/response/list.response";
|
||||
|
||||
import {
|
||||
OrganizationUserAcceptInitRequest,
|
||||
OrganizationUserAcceptRequest,
|
||||
OrganizationUserBulkConfirmRequest,
|
||||
OrganizationUserConfirmRequest,
|
||||
@@ -94,6 +95,20 @@ export abstract class OrganizationUserService {
|
||||
ids: string[]
|
||||
): Promise<ListResponse<OrganizationUserBulkResponse>>;
|
||||
|
||||
/**
|
||||
* Accept an invitation to initialize and join an organization created via the Admin Portal **only**.
|
||||
* This is only used once for the initial Owner, because it also creates the organization's encryption keys.
|
||||
* This should not be used for organizations created via the Web client.
|
||||
* @param organizationId - Identifier for the organization to accept
|
||||
* @param id - Organization user identifier
|
||||
* @param request - Request details for accepting the invitation
|
||||
*/
|
||||
abstract postOrganizationUserAcceptInit(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserAcceptInitRequest
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
* Accept an organization user invitation
|
||||
* @param organizationId - Identifier for the organization to accept
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./organization-user-accept-init.request";
|
||||
export * from "./organization-user-accept.request";
|
||||
export * from "./organization-user-bulk-confirm.request";
|
||||
export * from "./organization-user-confirm.request";
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import { OrganizationKeysRequest } from "../../../admin-console/models/request/organization-keys.request";
|
||||
|
||||
export class OrganizationUserAcceptInitRequest {
|
||||
token: string;
|
||||
key: string;
|
||||
keys: OrganizationKeysRequest;
|
||||
collectionName: string;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ProductType } from "../../../enums";
|
||||
import { ProductType, ProviderType } from "../../../enums";
|
||||
import { OrganizationUserStatusType, OrganizationUserType } from "../../enums";
|
||||
import { PermissionsApi } from "../api/permissions.api";
|
||||
import { ProfileOrganizationResponse } from "../response/profile-organization.response";
|
||||
@@ -36,6 +36,7 @@ export class OrganizationData {
|
||||
hasPublicAndPrivateKeys: boolean;
|
||||
providerId: string;
|
||||
providerName: string;
|
||||
providerType?: ProviderType;
|
||||
isProviderUser: boolean;
|
||||
familySponsorshipFriendlyName: string;
|
||||
familySponsorshipAvailable: boolean;
|
||||
@@ -80,6 +81,7 @@ export class OrganizationData {
|
||||
this.hasPublicAndPrivateKeys = response.hasPublicAndPrivateKeys;
|
||||
this.providerId = response.providerId;
|
||||
this.providerName = response.providerName;
|
||||
this.providerType = response.providerType;
|
||||
this.familySponsorshipFriendlyName = response.familySponsorshipFriendlyName;
|
||||
this.familySponsorshipAvailable = response.familySponsorshipAvailable;
|
||||
this.planProductType = response.planProductType;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Jsonify } from "type-fest";
|
||||
|
||||
import { ProductType } from "../../../enums";
|
||||
import { ProductType, ProviderType } from "../../../enums";
|
||||
import { OrganizationUserStatusType, OrganizationUserType } from "../../enums";
|
||||
import { PermissionsApi } from "../api/permissions.api";
|
||||
import { OrganizationData } from "../data/organization.data";
|
||||
@@ -38,6 +38,7 @@ export class Organization {
|
||||
hasPublicAndPrivateKeys: boolean;
|
||||
providerId: string;
|
||||
providerName: string;
|
||||
providerType?: ProviderType;
|
||||
isProviderUser: boolean;
|
||||
familySponsorshipFriendlyName: string;
|
||||
familySponsorshipAvailable: boolean;
|
||||
@@ -86,6 +87,7 @@ export class Organization {
|
||||
this.hasPublicAndPrivateKeys = obj.hasPublicAndPrivateKeys;
|
||||
this.providerId = obj.providerId;
|
||||
this.providerName = obj.providerName;
|
||||
this.providerType = obj.providerType;
|
||||
this.isProviderUser = obj.isProviderUser;
|
||||
this.familySponsorshipFriendlyName = obj.familySponsorshipFriendlyName;
|
||||
this.familySponsorshipAvailable = obj.familySponsorshipAvailable;
|
||||
@@ -197,8 +199,26 @@ export class Organization {
|
||||
return this.canManagePolicies;
|
||||
}
|
||||
|
||||
get canManageBilling() {
|
||||
return this.isOwner && (this.isProviderUser || !this.hasProvider);
|
||||
get canViewSubscription() {
|
||||
if (this.canEditSubscription) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.hasProvider && this.providerType === ProviderType.Msp
|
||||
? this.isProviderUser
|
||||
: this.isOwner;
|
||||
}
|
||||
|
||||
get canEditSubscription() {
|
||||
return this.hasProvider ? this.isProviderUser : this.isOwner;
|
||||
}
|
||||
|
||||
get canEditPaymentMethods() {
|
||||
return this.canEditSubscription;
|
||||
}
|
||||
|
||||
get canViewBillingHistory() {
|
||||
return this.canEditSubscription;
|
||||
}
|
||||
|
||||
get hasProvider() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ProductType } from "../../../enums";
|
||||
import { ProductType, ProviderType } from "../../../enums";
|
||||
import { BaseResponse } from "../../../models/response/base.response";
|
||||
import { OrganizationUserStatusType, OrganizationUserType } from "../../enums";
|
||||
import { PermissionsApi } from "../api/permissions.api";
|
||||
@@ -37,6 +37,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
|
||||
userId: string;
|
||||
providerId: string;
|
||||
providerName: string;
|
||||
providerType?: ProviderType;
|
||||
familySponsorshipFriendlyName: string;
|
||||
familySponsorshipAvailable: boolean;
|
||||
planProductType: ProductType;
|
||||
@@ -82,6 +83,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
|
||||
this.userId = this.getResponseProperty("UserId");
|
||||
this.providerId = this.getResponseProperty("ProviderId");
|
||||
this.providerName = this.getResponseProperty("ProviderName");
|
||||
this.providerType = this.getResponseProperty("ProviderType");
|
||||
this.familySponsorshipFriendlyName = this.getResponseProperty("FamilySponsorshipFriendlyName");
|
||||
this.familySponsorshipAvailable = this.getResponseProperty("FamilySponsorshipAvailable");
|
||||
this.planProductType = this.getResponseProperty("PlanProductType");
|
||||
|
||||
@@ -75,7 +75,7 @@ export class BillingSubscriptionItemResponse extends BaseResponse {
|
||||
|
||||
export class BillingSubscriptionUpcomingInvoiceResponse extends BaseResponse {
|
||||
date: string;
|
||||
amount: number;
|
||||
amount?: number;
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
|
||||
@@ -16,6 +16,7 @@ export * from "./log-level-type.enum";
|
||||
export * from "./native-messaging-version.enum";
|
||||
export * from "./notification-type.enum";
|
||||
export * from "./product-type.enum";
|
||||
export * from "./provider-type.enum";
|
||||
export * from "./secure-note-type.enum";
|
||||
export * from "./state-version.enum";
|
||||
export * from "./storage-location.enum";
|
||||
|
||||
4
libs/common/src/enums/provider-type.enum.ts
Normal file
4
libs/common/src/enums/provider-type.enum.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export enum ProviderType {
|
||||
Msp = 0,
|
||||
Reseller = 1,
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ApiService } from "../../abstractions/api.service";
|
||||
import { OrganizationUserService } from "../../abstractions/organization-user/organization-user.service";
|
||||
import {
|
||||
OrganizationUserAcceptInitRequest,
|
||||
OrganizationUserAcceptRequest,
|
||||
OrganizationUserBulkConfirmRequest,
|
||||
OrganizationUserConfirmRequest,
|
||||
@@ -135,6 +136,20 @@ export class OrganizationUserServiceImplementation implements OrganizationUserSe
|
||||
return new ListResponse(r, OrganizationUserBulkResponse);
|
||||
}
|
||||
|
||||
postOrganizationUserAcceptInit(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserAcceptInitRequest
|
||||
): Promise<void> {
|
||||
return this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + organizationId + "/users/" + id + "/accept-init",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
postOrganizationUserAccept(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
|
||||
Reference in New Issue
Block a user