mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
CLI device approvals - Use single deny endpoint (#9763)
This commit is contained in:
@@ -43,7 +43,7 @@ export class ApproveCommand {
|
|||||||
|
|
||||||
const request = pendingRequests.find((r) => r.id == id);
|
const request = pendingRequests.find((r) => r.id == id);
|
||||||
if (request == null) {
|
if (request == null) {
|
||||||
return Response.error("Invalid request id");
|
return Response.error("The request id is invalid.");
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.organizationAuthRequestService.approvePendingRequest(organizationId, request);
|
await this.organizationAuthRequestService.approvePendingRequest(organizationId, request);
|
||||||
|
|||||||
@@ -38,10 +38,16 @@ export class DenyCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.organizationAuthRequestService.denyPendingRequests(organizationId, id);
|
await this.organizationAuthRequestService.denyPendingRequest(organizationId, id);
|
||||||
return Response.success();
|
return Response.success();
|
||||||
} catch (e) {
|
} catch (error) {
|
||||||
return Response.error(e);
|
if (error?.statusCode === 404) {
|
||||||
|
return Response.error(
|
||||||
|
"The request id is invalid or you do not have permission to update it.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,4 +61,14 @@ export class OrganizationAuthRequestApiService {
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async denyPendingRequest(organizationId: string, requestId: string): Promise<void> {
|
||||||
|
await this.apiService.send(
|
||||||
|
"POST",
|
||||||
|
`/organizations/${organizationId}/auth-requests/${requestId}`,
|
||||||
|
new AdminAuthRequestUpdateRequest(false),
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ export class OrganizationAuthRequestService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async denyPendingRequest(organizationId: string, requestId: string) {
|
||||||
|
await this.organizationAuthRequestApiService.denyPendingRequest(organizationId, requestId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a copy of the user key that has been encrypted with the provided device's public key.
|
* Creates a copy of the user key that has been encrypted with the provided device's public key.
|
||||||
* @param organizationId
|
* @param organizationId
|
||||||
|
|||||||
Reference in New Issue
Block a user