1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 09:32:48 -05:00

Added Several New Reference Events (#1500)

* added enum values for new events

* hooked up directory sync event

* upgraded the OrganizationUpgrade ReferenceEvent

* Added metadata to the OrganizationUserInvited event noting if this is the first event sent from an organization

* Added metadata to the AdjustedSeats event

* Implemented vaultImported event

* Implemented FirstGroupAdded event

* Implemented FirstCollectionAdded event

* Implemented FirstSecretAdded event type

* Implemented SalesAssisted reference event

* changed events to match updated requirements

* renamed an event enum
This commit is contained in:
Addison Beck
2021-08-10 14:38:58 -04:00
committed by GitHub
parent 2e1df91232
commit 7928b25796
11 changed files with 98 additions and 25 deletions

View File

@ -37,6 +37,7 @@ namespace Bit.Core.Context
public virtual bool IsBot { get; set; }
public virtual bool MaybeBot { get; set; }
public virtual int? BotScore { get; set; }
public virtual string ClientId { get; set; }
public CurrentContext(IProviderUserRepository providerUserRepository)
{
@ -114,19 +115,19 @@ namespace Bit.Core.Context
UserId = subIdGuid;
}
var clientId = GetClaimValue(claimsDict, "client_id");
ClientId = GetClaimValue(claimsDict, "client_id");
var clientSubject = GetClaimValue(claimsDict, "client_sub");
var orgApi = false;
if (clientSubject != null)
{
if (clientId?.StartsWith("installation.") ?? false)
if (ClientId?.StartsWith("installation.") ?? false)
{
if (Guid.TryParse(clientSubject, out var idGuid))
{
InstallationId = idGuid;
}
}
else if (clientId?.StartsWith("organization.") ?? false)
else if (ClientId?.StartsWith("organization.") ?? false)
{
if (Guid.TryParse(clientSubject, out var idGuid))
{