1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-07 09:31:31 +01:00

react to policy api changes

This commit is contained in:
Kyle Spearrin 2020-01-20 08:54:51 -05:00
parent 6c8407196b
commit 7d8143b288
2 changed files with 9 additions and 17 deletions

View File

@ -1,3 +1,5 @@
import { PolicyType } from '../enums/policyType';
import { EnvironmentUrls } from '../models/domain/environmentUrls'; import { EnvironmentUrls } from '../models/domain/environmentUrls';
import { BitPayInvoiceRequest } from '../models/request/bitPayInvoiceRequest'; import { BitPayInvoiceRequest } from '../models/request/bitPayInvoiceRequest';
@ -188,11 +190,9 @@ export abstract class ApiService {
deleteGroup: (organizationId: string, id: string) => Promise<any>; deleteGroup: (organizationId: string, id: string) => Promise<any>;
deleteGroupUser: (organizationId: string, id: string, organizationUserId: string) => Promise<any>; deleteGroupUser: (organizationId: string, id: string, organizationUserId: string) => Promise<any>;
getPolicy: (organizationId: string, id: string) => Promise<PolicyResponse>; getPolicy: (organizationId: string, type: PolicyType) => Promise<PolicyResponse>;
getPolicies: (organizationId: string) => Promise<ListResponse<PolicyResponse>>; getPolicies: (organizationId: string) => Promise<ListResponse<PolicyResponse>>;
postPolicy: (organizationId: string, request: PolicyRequest) => Promise<PolicyResponse>; putPolicy: (organizationId: string, type: PolicyType, request: PolicyRequest) => Promise<PolicyResponse>;
putPolicy: (organizationId: string, id: string, request: PolicyRequest) => Promise<PolicyResponse>;
deletePolicy: (organizationId: string, id: string) => Promise<any>;
getOrganizationUser: (organizationId: string, id: string) => Promise<OrganizationUserDetailsResponse>; getOrganizationUser: (organizationId: string, id: string) => Promise<OrganizationUserDetailsResponse>;
getOrganizationUserGroups: (organizationId: string, id: string) => Promise<string[]>; getOrganizationUserGroups: (organizationId: string, id: string) => Promise<string[]>;

View File

@ -1,4 +1,5 @@
import { DeviceType } from '../enums/deviceType'; import { DeviceType } from '../enums/deviceType';
import { PolicyType } from '../enums/policyType';
import { ApiService as ApiServiceAbstraction } from '../abstractions/api.service'; import { ApiService as ApiServiceAbstraction } from '../abstractions/api.service';
import { PlatformUtilsService } from '../abstractions/platformUtils.service'; import { PlatformUtilsService } from '../abstractions/platformUtils.service';
@ -553,8 +554,8 @@ export class ApiService implements ApiServiceAbstraction {
// Policy APIs // Policy APIs
async getPolicy(organizationId: string, id: string): Promise<PolicyResponse> { async getPolicy(organizationId: string, type: PolicyType): Promise<PolicyResponse> {
const r = await this.send('GET', '/organizations/' + organizationId + '/policies/' + id, null, true, true); const r = await this.send('GET', '/organizations/' + organizationId + '/policies/' + type, null, true, true);
return new PolicyResponse(r); return new PolicyResponse(r);
} }
@ -563,20 +564,11 @@ export class ApiService implements ApiServiceAbstraction {
return new ListResponse(r, PolicyResponse); return new ListResponse(r, PolicyResponse);
} }
async postPolicy(organizationId: string, request: PolicyRequest): Promise<PolicyResponse> { async putPolicy(organizationId: string, type: PolicyType, request: PolicyRequest): Promise<PolicyResponse> {
const r = await this.send('POST', '/organizations/' + organizationId + '/policies', request, true, true); const r = await this.send('PUT', '/organizations/' + organizationId + '/policies/' + type, request, true, true);
return new PolicyResponse(r); return new PolicyResponse(r);
} }
async putPolicy(organizationId: string, id: string, request: PolicyRequest): Promise<PolicyResponse> {
const r = await this.send('PUT', '/organizations/' + organizationId + '/policies/' + id, request, true, true);
return new PolicyResponse(r);
}
deletePolicy(organizationId: string, id: string): Promise<any> {
return this.send('DELETE', '/organizations/' + organizationId + '/policies/' + id, null, true, false);
}
// Organization User APIs // Organization User APIs
async getOrganizationUser(organizationId: string, id: string): Promise<OrganizationUserDetailsResponse> { async getOrganizationUser(organizationId: string, id: string): Promise<OrganizationUserDetailsResponse> {