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

[Reset Password] Enrollment API, event type, and models update (#315)

This commit is contained in:
Vincent Salucci 2021-03-31 11:05:09 -05:00 committed by GitHub
parent 5c734747a9
commit f4f00b1eb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 1 deletions

View File

@ -37,6 +37,7 @@ import { OrganizationUpgradeRequest } from '../models/request/organizationUpgrad
import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest';
import { OrganizationUserConfirmRequest } from '../models/request/organizationUserConfirmRequest';
import { OrganizationUserInviteRequest } from '../models/request/organizationUserInviteRequest';
import { OrganizationUserResetPasswordEnrollmentRequest } from '../models/request/organizationUserResetPasswordEnrollmentRequest';
import { OrganizationUserUpdateGroupsRequest } from '../models/request/organizationUserUpdateGroupsRequest';
import { OrganizationUserUpdateRequest } from '../models/request/organizationUserUpdateRequest';
import { PasswordHintRequest } from '../models/request/passwordHintRequest';
@ -278,6 +279,8 @@ export abstract class ApiService {
putOrganizationUser: (organizationId: string, id: string, request: OrganizationUserUpdateRequest) => Promise<any>;
putOrganizationUserGroups: (organizationId: string, id: string,
request: OrganizationUserUpdateGroupsRequest) => Promise<any>;
putOrganizationUserResetPasswordEnrollment: (organizationId: string, userId: string,
request: OrganizationUserResetPasswordEnrollmentRequest) => Promise<any>;
deleteOrganizationUser: (organizationId: string, id: string) => Promise<any>;
getSync: () => Promise<SyncResponse>;

View File

@ -40,6 +40,8 @@ export enum EventType {
OrganizationUser_Removed = 1503,
OrganizationUser_UpdatedGroups = 1504,
OrganizationUser_UnlinkedSso = 1505,
OrganizationUser_ResetPassword_Enroll = 1506,
OrganizationUser_ResetPassword_Withdraw = 1507,
Organization_Updated = 1600,
Organization_PurgedVault = 1601,

View File

@ -27,6 +27,8 @@ export class OrganizationData {
ssoBound: boolean;
identifier: string;
permissions: PermissionsApi;
resetPasswordKey: string;
userId: string;
constructor(response: ProfileOrganizationResponse) {
this.id = response.id;
@ -51,5 +53,7 @@ export class OrganizationData {
this.ssoBound = response.ssoBound;
this.identifier = response.identifier;
this.permissions = response.permissions;
this.resetPasswordKey = response.resetPasswordKey;
this.userId = response.userId;
}
}

View File

@ -28,6 +28,8 @@ export class Organization {
ssoBound: boolean;
identifier: string;
permissions: PermissionsApi;
resetPasswordKey: string;
userId: string;
constructor(obj?: OrganizationData) {
if (obj == null) {
@ -56,6 +58,8 @@ export class Organization {
this.ssoBound = obj.ssoBound;
this.identifier = obj.identifier;
this.permissions = obj.permissions;
this.resetPasswordKey = obj.resetPasswordKey;
this.userId = obj.userId;
}
get canAccess() {
@ -117,4 +121,8 @@ export class Organization {
get canManageUsers() {
return this.isAdmin || this.permissions.manageUsers;
}
get isResetPasswordEnrolled() {
return this.resetPasswordKey != null;
}
}

View File

@ -0,0 +1,3 @@
export class OrganizationUserResetPasswordEnrollmentRequest {
resetPasswordKey: string;
}

View File

@ -28,6 +28,8 @@ export class ProfileOrganizationResponse extends BaseResponse {
ssoBound: boolean;
identifier: string;
permissions: PermissionsApi;
resetPasswordKey: string;
userId: string;
constructor(response: any) {
super(response);
@ -54,5 +56,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
this.ssoBound = this.getResponseProperty('SsoBound');
this.identifier = this.getResponseProperty('Identifier');
this.permissions = new PermissionsApi(this.getResponseProperty('permissions'));
this.resetPasswordKey = this.getResponseProperty('ResetPasswordKey');
this.userId = this.getResponseProperty('UserId');
}
}

View File

@ -41,6 +41,7 @@ import { OrganizationUpgradeRequest } from '../models/request/organizationUpgrad
import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest';
import { OrganizationUserConfirmRequest } from '../models/request/organizationUserConfirmRequest';
import { OrganizationUserInviteRequest } from '../models/request/organizationUserInviteRequest';
import { OrganizationUserResetPasswordEnrollmentRequest } from '../models/request/organizationUserResetPasswordEnrollmentRequest';
import { OrganizationUserUpdateGroupsRequest } from '../models/request/organizationUserUpdateGroupsRequest';
import { OrganizationUserUpdateRequest } from '../models/request/organizationUserUpdateRequest';
import { PasswordHintRequest } from '../models/request/passwordHintRequest';
@ -820,6 +821,12 @@ export class ApiService implements ApiServiceAbstraction {
return this.send('PUT', '/organizations/' + organizationId + '/users/' + id + '/groups', request, true, false);
}
putOrganizationUserResetPasswordEnrollment(organizationId: string, userId: string,
request: OrganizationUserResetPasswordEnrollmentRequest): Promise<any> {
return this.send('PUT', '/organizations/' + organizationId + '/users/' + userId + '/reset-password-enrollment',
request, true, false);
}
deleteOrganizationUser(organizationId: string, id: string): Promise<any> {
return this.send('DELETE', '/organizations/' + organizationId + '/users/' + id, null, true, false);
}