mirror of
https://github.com/bitwarden/browser
synced 2026-01-07 11:03:30 +00:00
Use MP policies when registering a new user through SSO (#587)
* use MP policies when registering a new user through SSO * prettier and linting
This commit is contained in:
@@ -1047,6 +1047,20 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
return new ListResponse(r, PolicyResponse);
|
||||
}
|
||||
|
||||
async getPoliciesByInvitedUser(
|
||||
organizationId: string,
|
||||
userId: string
|
||||
): Promise<ListResponse<PolicyResponse>> {
|
||||
const r = await this.send(
|
||||
"GET",
|
||||
"/organizations/" + organizationId + "/policies/invited-user?" + "userId=" + userId,
|
||||
null,
|
||||
false,
|
||||
true
|
||||
);
|
||||
return new ListResponse(r, PolicyResponse);
|
||||
}
|
||||
|
||||
async putPolicy(
|
||||
organizationId: string,
|
||||
type: PolicyType,
|
||||
|
||||
@@ -78,6 +78,15 @@ export class PolicyService implements PolicyServiceAbstraction {
|
||||
await this.stateService.setEncryptedPolicies(null, { userId: userId });
|
||||
}
|
||||
|
||||
async getMasterPasswordPoliciesForInvitedUsers(
|
||||
orgId: string
|
||||
): Promise<MasterPasswordPolicyOptions> {
|
||||
const userId = await this.stateService.getUserId();
|
||||
const response = await this.apiService.getPoliciesByInvitedUser(orgId, userId);
|
||||
const policies = await this.mapPoliciesFromToken(response);
|
||||
return this.getMasterPasswordPolicyOptions(policies);
|
||||
}
|
||||
|
||||
async getMasterPasswordPolicyOptions(policies?: Policy[]): Promise<MasterPasswordPolicyOptions> {
|
||||
let enforcedOptions: MasterPasswordPolicyOptions = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user