1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

group user apis

This commit is contained in:
Kyle Spearrin
2018-10-17 22:56:28 -04:00
parent 2b8ffea494
commit d1f7a97011
3 changed files with 11 additions and 28 deletions

View File

@@ -70,7 +70,6 @@ import {
GroupDetailsResponse,
GroupResponse,
} from '../models/response/groupResponse';
import { GroupUserResponse } from '../models/response/groupUserResponse';
import { IdentityTokenResponse } from '../models/response/identityTokenResponse';
import { IdentityTwoFactorResponse } from '../models/response/identityTwoFactorResponse';
import { ListResponse } from '../models/response/listResponse';
@@ -445,10 +444,10 @@ export class ApiService implements ApiServiceAbstraction {
return new ListResponse(r, CollectionResponse);
}
async getCollectionUsers(organizationId: string, id: string): Promise<ListResponse<SelectionReadOnlyResponse>> {
async getCollectionUsers(organizationId: string, id: string): Promise<SelectionReadOnlyResponse[]> {
const r = await this.send('GET', '/organizations/' + organizationId + '/collections/' + id + '/users',
null, true, true);
return new ListResponse(r, SelectionReadOnlyResponse);
return r.map((dr: any) => new SelectionReadOnlyResponse(dr));
}
async postCollection(organizationId: string, request: CollectionRequest): Promise<CollectionResponse> {
@@ -490,10 +489,10 @@ export class ApiService implements ApiServiceAbstraction {
return new ListResponse(r, GroupResponse);
}
async getGroupUsers(organizationId: string, id: string): Promise<ListResponse<GroupUserResponse>> {
async getGroupUsers(organizationId: string, id: string): Promise<string[]> {
const r = await this.send('GET', '/organizations/' + organizationId + '/groups/' + id + '/users',
null, true, true);
return new ListResponse(r, GroupUserResponse);
return r;
}
async postGroup(organizationId: string, request: GroupRequest): Promise<GroupResponse> {
@@ -506,6 +505,10 @@ export class ApiService implements ApiServiceAbstraction {
return new GroupResponse(r);
}
async putGroupUsers(organizationId: string, id: string, request: string[]): Promise<any> {
await this.send('PUT', '/organizations/' + organizationId + '/groups/' + id + '/users', request, true, false);
}
deleteGroup(organizationId: string, id: string): Promise<any> {
return this.send('DELETE', '/organizations/' + organizationId + '/groups/' + id, null, true, false);
}