mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
group user apis
This commit is contained in:
parent
2b8ffea494
commit
d1f7a97011
@ -63,7 +63,6 @@ import {
|
|||||||
GroupDetailsResponse,
|
GroupDetailsResponse,
|
||||||
GroupResponse,
|
GroupResponse,
|
||||||
} from '../models/response/groupResponse';
|
} from '../models/response/groupResponse';
|
||||||
import { GroupUserResponse } from '../models/response/groupUserResponse';
|
|
||||||
import { IdentityTokenResponse } from '../models/response/identityTokenResponse';
|
import { IdentityTokenResponse } from '../models/response/identityTokenResponse';
|
||||||
import { IdentityTwoFactorResponse } from '../models/response/identityTwoFactorResponse';
|
import { IdentityTwoFactorResponse } from '../models/response/identityTwoFactorResponse';
|
||||||
import { ListResponse } from '../models/response/listResponse';
|
import { ListResponse } from '../models/response/listResponse';
|
||||||
@ -158,7 +157,7 @@ export abstract class ApiService {
|
|||||||
getCollectionDetails: (organizationId: string, id: string) => Promise<CollectionGroupDetailsResponse>;
|
getCollectionDetails: (organizationId: string, id: string) => Promise<CollectionGroupDetailsResponse>;
|
||||||
getUserCollections: () => Promise<ListResponse<CollectionResponse>>;
|
getUserCollections: () => Promise<ListResponse<CollectionResponse>>;
|
||||||
getCollections: (organizationId: string) => Promise<ListResponse<CollectionResponse>>;
|
getCollections: (organizationId: string) => Promise<ListResponse<CollectionResponse>>;
|
||||||
getCollectionUsers: (organizationId: string, id: string) => Promise<ListResponse<SelectionReadOnlyResponse>>;
|
getCollectionUsers: (organizationId: string, id: string) => Promise<SelectionReadOnlyResponse[]>;
|
||||||
postCollection: (organizationId: string, request: CollectionRequest) => Promise<CollectionResponse>;
|
postCollection: (organizationId: string, request: CollectionRequest) => Promise<CollectionResponse>;
|
||||||
putCollectionUsers: (organizationId: string, id: string, request: SelectionReadOnlyRequest[]) => Promise<any>;
|
putCollectionUsers: (organizationId: string, id: string, request: SelectionReadOnlyRequest[]) => Promise<any>;
|
||||||
putCollection: (organizationId: string, id: string, request: CollectionRequest) => Promise<CollectionResponse>;
|
putCollection: (organizationId: string, id: string, request: CollectionRequest) => Promise<CollectionResponse>;
|
||||||
@ -167,9 +166,10 @@ export abstract class ApiService {
|
|||||||
|
|
||||||
getGroupDetails: (organizationId: string, id: string) => Promise<GroupDetailsResponse>;
|
getGroupDetails: (organizationId: string, id: string) => Promise<GroupDetailsResponse>;
|
||||||
getGroups: (organizationId: string) => Promise<ListResponse<GroupResponse>>;
|
getGroups: (organizationId: string) => Promise<ListResponse<GroupResponse>>;
|
||||||
getGroupUsers: (organizationId: string, id: string) => Promise<ListResponse<GroupUserResponse>>;
|
getGroupUsers: (organizationId: string, id: string) => Promise<string[]>;
|
||||||
postGroup: (organizationId: string, request: GroupRequest) => Promise<GroupResponse>;
|
postGroup: (organizationId: string, request: GroupRequest) => Promise<GroupResponse>;
|
||||||
putGroup: (organizationId: string, id: string, request: GroupRequest) => Promise<GroupResponse>;
|
putGroup: (organizationId: string, id: string, request: GroupRequest) => Promise<GroupResponse>;
|
||||||
|
putGroupUsers: (organizationId: string, id: string, request: string[]) => Promise<any>;
|
||||||
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>;
|
||||||
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
import { OrganizationUserStatusType } from '../../enums/organizationUserStatusType';
|
|
||||||
import { OrganizationUserType } from '../../enums/organizationUserType';
|
|
||||||
|
|
||||||
export class GroupUserResponse {
|
|
||||||
organizationUserId: string;
|
|
||||||
accessAll: boolean;
|
|
||||||
name: string;
|
|
||||||
email: string;
|
|
||||||
type: OrganizationUserType;
|
|
||||||
status: OrganizationUserStatusType;
|
|
||||||
|
|
||||||
constructor(response: any) {
|
|
||||||
this.organizationUserId = response.OrganizationUserId;
|
|
||||||
this.accessAll = response.AccessAll;
|
|
||||||
this.name = response.Name;
|
|
||||||
this.email = response.Email;
|
|
||||||
this.type = response.Type;
|
|
||||||
this.status = response.Status;
|
|
||||||
}
|
|
||||||
}
|
|
@ -70,7 +70,6 @@ import {
|
|||||||
GroupDetailsResponse,
|
GroupDetailsResponse,
|
||||||
GroupResponse,
|
GroupResponse,
|
||||||
} from '../models/response/groupResponse';
|
} from '../models/response/groupResponse';
|
||||||
import { GroupUserResponse } from '../models/response/groupUserResponse';
|
|
||||||
import { IdentityTokenResponse } from '../models/response/identityTokenResponse';
|
import { IdentityTokenResponse } from '../models/response/identityTokenResponse';
|
||||||
import { IdentityTwoFactorResponse } from '../models/response/identityTwoFactorResponse';
|
import { IdentityTwoFactorResponse } from '../models/response/identityTwoFactorResponse';
|
||||||
import { ListResponse } from '../models/response/listResponse';
|
import { ListResponse } from '../models/response/listResponse';
|
||||||
@ -445,10 +444,10 @@ export class ApiService implements ApiServiceAbstraction {
|
|||||||
return new ListResponse(r, CollectionResponse);
|
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',
|
const r = await this.send('GET', '/organizations/' + organizationId + '/collections/' + id + '/users',
|
||||||
null, true, true);
|
null, true, true);
|
||||||
return new ListResponse(r, SelectionReadOnlyResponse);
|
return r.map((dr: any) => new SelectionReadOnlyResponse(dr));
|
||||||
}
|
}
|
||||||
|
|
||||||
async postCollection(organizationId: string, request: CollectionRequest): Promise<CollectionResponse> {
|
async postCollection(organizationId: string, request: CollectionRequest): Promise<CollectionResponse> {
|
||||||
@ -490,10 +489,10 @@ export class ApiService implements ApiServiceAbstraction {
|
|||||||
return new ListResponse(r, GroupResponse);
|
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',
|
const r = await this.send('GET', '/organizations/' + organizationId + '/groups/' + id + '/users',
|
||||||
null, true, true);
|
null, true, true);
|
||||||
return new ListResponse(r, GroupUserResponse);
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
async postGroup(organizationId: string, request: GroupRequest): Promise<GroupResponse> {
|
async postGroup(organizationId: string, request: GroupRequest): Promise<GroupResponse> {
|
||||||
@ -506,6 +505,10 @@ export class ApiService implements ApiServiceAbstraction {
|
|||||||
return new GroupResponse(r);
|
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> {
|
deleteGroup(organizationId: string, id: string): Promise<any> {
|
||||||
return this.send('DELETE', '/organizations/' + organizationId + '/groups/' + id, null, true, false);
|
return this.send('DELETE', '/organizations/' + organizationId + '/groups/' + id, null, true, false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user