mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[Key Connector] Add event logging for first SSO login (#1724)
* Add null checks to fix logging from SSO controller * Add FirstSsoLogin event logging
This commit is contained in:
@ -392,13 +392,13 @@ namespace Bit.Core.Context
|
||||
|
||||
public async Task<Guid?> ProviderIdForOrg(Guid orgId)
|
||||
{
|
||||
if (Organizations.Any(org => org.Id == orgId))
|
||||
if (Organizations?.Any(org => org.Id == orgId) ?? false)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var po = (await GetProviderOrganizations())
|
||||
.FirstOrDefault(po => po.OrganizationId == orgId);
|
||||
?.FirstOrDefault(po => po.OrganizationId == orgId);
|
||||
|
||||
return po?.ProviderId;
|
||||
}
|
||||
@ -465,7 +465,7 @@ namespace Bit.Core.Context
|
||||
|
||||
protected async Task<IEnumerable<ProviderUserOrganizationDetails>> GetProviderOrganizations()
|
||||
{
|
||||
if (_providerUserOrganizations == null)
|
||||
if (_providerUserOrganizations == null && UserId.HasValue)
|
||||
{
|
||||
_providerUserOrganizations = await _providerUserRepository.GetManyOrganizationDetailsByUserAsync(UserId.Value, ProviderUserStatusType.Confirmed);
|
||||
}
|
||||
|
@ -50,6 +50,7 @@
|
||||
OrganizationUser_ResetPassword_Withdraw = 1507,
|
||||
OrganizationUser_AdminResetPassword = 1508,
|
||||
OrganizationUser_ResetSsoLink = 1509,
|
||||
OrganizationUser_FirstSsoLogin = 1510,
|
||||
|
||||
Organization_Updated = 1600,
|
||||
Organization_PurgedVault = 1601,
|
||||
|
Reference in New Issue
Block a user