mirror of
https://github.com/bitwarden/android.git
synced 2025-01-12 11:17:30 +03:00
[SSO Auto Enroll] Auto Enroll status retrieval (#1540)
* [SSO Auto Enroll] Auto Enroll status retrieval * Updated object property to match server
This commit is contained in:
parent
14b51b1a7f
commit
024d9380c9
4 changed files with 30 additions and 6 deletions
|
@ -98,11 +98,20 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
await CheckPasswordPolicy();
|
await CheckPasswordPolicy();
|
||||||
|
|
||||||
var org = await _userService.GetOrganizationByIdentifierAsync(OrgIdentifier);
|
try
|
||||||
OrgId = org?.Id;
|
{
|
||||||
var policyList = await _policyService.GetAll(PolicyType.ResetPassword);
|
var response = await _apiService.GetOrganizationAutoEnrollStatusAsync(OrgIdentifier);
|
||||||
var policyResult = _policyService.GetResetPasswordPolicyOptions(policyList, OrgId);
|
OrgId = response.Id;
|
||||||
ResetPasswordAutoEnroll = policyResult.Item2 && policyResult.Item1.AutoEnrollEnabled;
|
ResetPasswordAutoEnroll = response.ResetPasswordEnrolled;
|
||||||
|
}
|
||||||
|
catch (ApiException e)
|
||||||
|
{
|
||||||
|
if (e?.Error != null)
|
||||||
|
{
|
||||||
|
await _platformUtilsService.ShowDialogAsync(e.Error.GetSingleMessage(),
|
||||||
|
AppResources.AnErrorHasOccurred);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SubmitAsync()
|
public async Task SubmitAsync()
|
||||||
|
|
|
@ -59,6 +59,7 @@ namespace Bit.Core.Abstractions
|
||||||
Task PutDeviceTokenAsync(string identifier, DeviceTokenRequest request);
|
Task PutDeviceTokenAsync(string identifier, DeviceTokenRequest request);
|
||||||
Task PostEventsCollectAsync(IEnumerable<EventRequest> request);
|
Task PostEventsCollectAsync(IEnumerable<EventRequest> request);
|
||||||
Task<OrganizationKeysResponse> GetOrganizationKeysAsync(string id);
|
Task<OrganizationKeysResponse> GetOrganizationKeysAsync(string id);
|
||||||
|
Task<OrganizationAutoEnrollStatusResponse> GetOrganizationAutoEnrollStatusAsync(string identifier);
|
||||||
Task PutOrganizationUserResetPasswordEnrollmentAsync(string orgId, string userId,
|
Task PutOrganizationUserResetPasswordEnrollmentAsync(string orgId, string userId,
|
||||||
OrganizationUserResetPasswordEnrollmentRequest request);
|
OrganizationUserResetPasswordEnrollmentRequest request);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Bit.Core.Models.Response
|
||||||
|
{
|
||||||
|
public class OrganizationAutoEnrollStatusResponse
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public bool ResetPasswordEnrolled { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -411,6 +411,12 @@ namespace Bit.Core.Services
|
||||||
return SendAsync<object, OrganizationKeysResponse>(HttpMethod.Get, $"/organizations/{id}/keys", null, true, true);
|
return SendAsync<object, OrganizationKeysResponse>(HttpMethod.Get, $"/organizations/{id}/keys", null, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<OrganizationAutoEnrollStatusResponse> GetOrganizationAutoEnrollStatusAsync(string identifier)
|
||||||
|
{
|
||||||
|
return SendAsync<object, OrganizationAutoEnrollStatusResponse>(HttpMethod.Get,
|
||||||
|
$"/organizations/{identifier}/auto-enroll-status", null, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Organization User APIs
|
#region Organization User APIs
|
||||||
|
|
Loading…
Reference in a new issue