1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

Provide new feature flag context for devices (#5226)

This commit is contained in:
Matt Bishop
2025-01-08 13:54:34 -05:00
committed by GitHub
parent 377c7925e2
commit 92d9b88afb
2 changed files with 12 additions and 0 deletions

View File

@ -16,6 +16,7 @@ public class LaunchDarklyFeatureService : IFeatureService
private readonly ICurrentContext _currentContext;
private const string _anonymousUser = "25a15cac-58cf-4ac0-ad0f-b17c4bd92294";
private const string _contextKindDevice = "device";
private const string _contextKindOrganization = "organization";
private const string _contextKindServiceAccount = "service-account";
@ -158,6 +159,16 @@ public class LaunchDarklyFeatureService : IFeatureService
var builder = LaunchDarkly.Sdk.Context.MultiBuilder();
if (!string.IsNullOrWhiteSpace(_currentContext.DeviceIdentifier))
{
var ldDevice = LaunchDarkly.Sdk.Context.Builder(_currentContext.DeviceIdentifier);
ldDevice.Kind(_contextKindDevice);
SetCommonContextAttributes(ldDevice);
builder.Add(ldDevice.Build());
}
switch (_currentContext.IdentityClientType)
{
case IdentityClientType.User: