1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-28 13:15:12 +01:00

Provide client type in LD context (#4798)

This commit is contained in:
Matt Bishop 2024-09-24 10:18:20 -04:00 committed by GitHub
parent f7bc5dfb2e
commit 080057c564
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -21,6 +21,7 @@ public class LaunchDarklyFeatureService : IFeatureService
private const string _contextAttributeClientVersion = "client-version"; private const string _contextAttributeClientVersion = "client-version";
private const string _contextAttributeDeviceType = "device-type"; private const string _contextAttributeDeviceType = "device-type";
private const string _contextAttributeClientType = "client-type";
private const string _contextAttributeOrganizations = "organizations"; private const string _contextAttributeOrganizations = "organizations";
public LaunchDarklyFeatureService( public LaunchDarklyFeatureService(
@ -149,6 +150,7 @@ public class LaunchDarklyFeatureService : IFeatureService
if (_currentContext.DeviceType.HasValue) if (_currentContext.DeviceType.HasValue)
{ {
builder.Set(_contextAttributeDeviceType, (int)_currentContext.DeviceType.Value); builder.Set(_contextAttributeDeviceType, (int)_currentContext.DeviceType.Value);
builder.Set(_contextAttributeClientType, (int)DeviceTypes.ToClientType(_currentContext.DeviceType.Value));
} }
} }

View File

@ -22,7 +22,6 @@ public static class DeviceTypes
DeviceType.LinuxCLI DeviceType.LinuxCLI
]; ];
public static IReadOnlyCollection<DeviceType> BrowserExtensionTypes { get; } = public static IReadOnlyCollection<DeviceType> BrowserExtensionTypes { get; } =
[ [
DeviceType.ChromeExtension, DeviceType.ChromeExtension,
@ -45,7 +44,7 @@ public static class DeviceTypes
DeviceType.UnknownBrowser DeviceType.UnknownBrowser
]; ];
private static ClientType ToClientType(DeviceType? deviceType) public static ClientType ToClientType(DeviceType? deviceType)
{ {
return deviceType switch return deviceType switch
{ {