mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
[Reset Password] Enrollment API, event type, and models update (#315)
This commit is contained in:
parent
5c734747a9
commit
f4f00b1eb2
@ -37,6 +37,7 @@ import { OrganizationUpgradeRequest } from '../models/request/organizationUpgrad
|
|||||||
import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest';
|
import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest';
|
||||||
import { OrganizationUserConfirmRequest } from '../models/request/organizationUserConfirmRequest';
|
import { OrganizationUserConfirmRequest } from '../models/request/organizationUserConfirmRequest';
|
||||||
import { OrganizationUserInviteRequest } from '../models/request/organizationUserInviteRequest';
|
import { OrganizationUserInviteRequest } from '../models/request/organizationUserInviteRequest';
|
||||||
|
import { OrganizationUserResetPasswordEnrollmentRequest } from '../models/request/organizationUserResetPasswordEnrollmentRequest';
|
||||||
import { OrganizationUserUpdateGroupsRequest } from '../models/request/organizationUserUpdateGroupsRequest';
|
import { OrganizationUserUpdateGroupsRequest } from '../models/request/organizationUserUpdateGroupsRequest';
|
||||||
import { OrganizationUserUpdateRequest } from '../models/request/organizationUserUpdateRequest';
|
import { OrganizationUserUpdateRequest } from '../models/request/organizationUserUpdateRequest';
|
||||||
import { PasswordHintRequest } from '../models/request/passwordHintRequest';
|
import { PasswordHintRequest } from '../models/request/passwordHintRequest';
|
||||||
@ -278,6 +279,8 @@ export abstract class ApiService {
|
|||||||
putOrganizationUser: (organizationId: string, id: string, request: OrganizationUserUpdateRequest) => Promise<any>;
|
putOrganizationUser: (organizationId: string, id: string, request: OrganizationUserUpdateRequest) => Promise<any>;
|
||||||
putOrganizationUserGroups: (organizationId: string, id: string,
|
putOrganizationUserGroups: (organizationId: string, id: string,
|
||||||
request: OrganizationUserUpdateGroupsRequest) => Promise<any>;
|
request: OrganizationUserUpdateGroupsRequest) => Promise<any>;
|
||||||
|
putOrganizationUserResetPasswordEnrollment: (organizationId: string, userId: string,
|
||||||
|
request: OrganizationUserResetPasswordEnrollmentRequest) => Promise<any>;
|
||||||
deleteOrganizationUser: (organizationId: string, id: string) => Promise<any>;
|
deleteOrganizationUser: (organizationId: string, id: string) => Promise<any>;
|
||||||
|
|
||||||
getSync: () => Promise<SyncResponse>;
|
getSync: () => Promise<SyncResponse>;
|
||||||
|
@ -40,6 +40,8 @@ export enum EventType {
|
|||||||
OrganizationUser_Removed = 1503,
|
OrganizationUser_Removed = 1503,
|
||||||
OrganizationUser_UpdatedGroups = 1504,
|
OrganizationUser_UpdatedGroups = 1504,
|
||||||
OrganizationUser_UnlinkedSso = 1505,
|
OrganizationUser_UnlinkedSso = 1505,
|
||||||
|
OrganizationUser_ResetPassword_Enroll = 1506,
|
||||||
|
OrganizationUser_ResetPassword_Withdraw = 1507,
|
||||||
|
|
||||||
Organization_Updated = 1600,
|
Organization_Updated = 1600,
|
||||||
Organization_PurgedVault = 1601,
|
Organization_PurgedVault = 1601,
|
||||||
|
@ -27,6 +27,8 @@ export class OrganizationData {
|
|||||||
ssoBound: boolean;
|
ssoBound: boolean;
|
||||||
identifier: string;
|
identifier: string;
|
||||||
permissions: PermissionsApi;
|
permissions: PermissionsApi;
|
||||||
|
resetPasswordKey: string;
|
||||||
|
userId: string;
|
||||||
|
|
||||||
constructor(response: ProfileOrganizationResponse) {
|
constructor(response: ProfileOrganizationResponse) {
|
||||||
this.id = response.id;
|
this.id = response.id;
|
||||||
@ -51,5 +53,7 @@ export class OrganizationData {
|
|||||||
this.ssoBound = response.ssoBound;
|
this.ssoBound = response.ssoBound;
|
||||||
this.identifier = response.identifier;
|
this.identifier = response.identifier;
|
||||||
this.permissions = response.permissions;
|
this.permissions = response.permissions;
|
||||||
|
this.resetPasswordKey = response.resetPasswordKey;
|
||||||
|
this.userId = response.userId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,8 @@ export class Organization {
|
|||||||
ssoBound: boolean;
|
ssoBound: boolean;
|
||||||
identifier: string;
|
identifier: string;
|
||||||
permissions: PermissionsApi;
|
permissions: PermissionsApi;
|
||||||
|
resetPasswordKey: string;
|
||||||
|
userId: string;
|
||||||
|
|
||||||
constructor(obj?: OrganizationData) {
|
constructor(obj?: OrganizationData) {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
@ -56,6 +58,8 @@ export class Organization {
|
|||||||
this.ssoBound = obj.ssoBound;
|
this.ssoBound = obj.ssoBound;
|
||||||
this.identifier = obj.identifier;
|
this.identifier = obj.identifier;
|
||||||
this.permissions = obj.permissions;
|
this.permissions = obj.permissions;
|
||||||
|
this.resetPasswordKey = obj.resetPasswordKey;
|
||||||
|
this.userId = obj.userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
get canAccess() {
|
get canAccess() {
|
||||||
@ -117,4 +121,8 @@ export class Organization {
|
|||||||
get canManageUsers() {
|
get canManageUsers() {
|
||||||
return this.isAdmin || this.permissions.manageUsers;
|
return this.isAdmin || this.permissions.manageUsers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isResetPasswordEnrolled() {
|
||||||
|
return this.resetPasswordKey != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
export class OrganizationUserResetPasswordEnrollmentRequest {
|
||||||
|
resetPasswordKey: string;
|
||||||
|
}
|
@ -28,6 +28,8 @@ export class ProfileOrganizationResponse extends BaseResponse {
|
|||||||
ssoBound: boolean;
|
ssoBound: boolean;
|
||||||
identifier: string;
|
identifier: string;
|
||||||
permissions: PermissionsApi;
|
permissions: PermissionsApi;
|
||||||
|
resetPasswordKey: string;
|
||||||
|
userId: string;
|
||||||
|
|
||||||
constructor(response: any) {
|
constructor(response: any) {
|
||||||
super(response);
|
super(response);
|
||||||
@ -54,5 +56,7 @@ export class ProfileOrganizationResponse extends BaseResponse {
|
|||||||
this.ssoBound = this.getResponseProperty('SsoBound');
|
this.ssoBound = this.getResponseProperty('SsoBound');
|
||||||
this.identifier = this.getResponseProperty('Identifier');
|
this.identifier = this.getResponseProperty('Identifier');
|
||||||
this.permissions = new PermissionsApi(this.getResponseProperty('permissions'));
|
this.permissions = new PermissionsApi(this.getResponseProperty('permissions'));
|
||||||
|
this.resetPasswordKey = this.getResponseProperty('ResetPasswordKey');
|
||||||
|
this.userId = this.getResponseProperty('UserId');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ import { OrganizationUpgradeRequest } from '../models/request/organizationUpgrad
|
|||||||
import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest';
|
import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest';
|
||||||
import { OrganizationUserConfirmRequest } from '../models/request/organizationUserConfirmRequest';
|
import { OrganizationUserConfirmRequest } from '../models/request/organizationUserConfirmRequest';
|
||||||
import { OrganizationUserInviteRequest } from '../models/request/organizationUserInviteRequest';
|
import { OrganizationUserInviteRequest } from '../models/request/organizationUserInviteRequest';
|
||||||
|
import { OrganizationUserResetPasswordEnrollmentRequest } from '../models/request/organizationUserResetPasswordEnrollmentRequest';
|
||||||
import { OrganizationUserUpdateGroupsRequest } from '../models/request/organizationUserUpdateGroupsRequest';
|
import { OrganizationUserUpdateGroupsRequest } from '../models/request/organizationUserUpdateGroupsRequest';
|
||||||
import { OrganizationUserUpdateRequest } from '../models/request/organizationUserUpdateRequest';
|
import { OrganizationUserUpdateRequest } from '../models/request/organizationUserUpdateRequest';
|
||||||
import { PasswordHintRequest } from '../models/request/passwordHintRequest';
|
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);
|
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> {
|
deleteOrganizationUser(organizationId: string, id: string): Promise<any> {
|
||||||
return this.send('DELETE', '/organizations/' + organizationId + '/users/' + id, null, true, false);
|
return this.send('DELETE', '/organizations/' + organizationId + '/users/' + id, null, true, false);
|
||||||
}
|
}
|
||||||
@ -1347,7 +1354,7 @@ export class ApiService implements ApiServiceAbstraction {
|
|||||||
if (this.isJsonResponse(response)) {
|
if (this.isJsonResponse(response)) {
|
||||||
responseJson = await response.json();
|
responseJson = await response.json();
|
||||||
} else if (this.isTextResponse(response)) {
|
} else if (this.isTextResponse(response)) {
|
||||||
responseJson = {Message: await response.text()};
|
responseJson = { Message: await response.text() };
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ErrorResponse(responseJson, response.status, tokenError);
|
return new ErrorResponse(responseJson, response.status, tokenError);
|
||||||
|
Loading…
Reference in New Issue
Block a user