mirror of
https://github.com/bitwarden/server
synced 2026-01-07 19:13:50 +00:00
Changed all C# control flow block statements to include space between keyword and open paren
This commit is contained in:
@@ -43,15 +43,15 @@ namespace Bit.Events.Controllers
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Post([FromBody]IEnumerable<EventModel> model)
|
||||
{
|
||||
if(model == null || !model.Any())
|
||||
if (model == null || !model.Any())
|
||||
{
|
||||
return new BadRequestResult();
|
||||
}
|
||||
var cipherEvents = new List<Tuple<Cipher, EventType, DateTime?>>();
|
||||
var ciphersCache = new Dictionary<Guid, Cipher>();
|
||||
foreach(var eventModel in model)
|
||||
foreach (var eventModel in model)
|
||||
{
|
||||
switch(eventModel.Type)
|
||||
switch (eventModel.Type)
|
||||
{
|
||||
// User events
|
||||
case EventType.User_ClientExportedVault:
|
||||
@@ -66,12 +66,12 @@ namespace Bit.Events.Controllers
|
||||
case EventType.Cipher_ClientToggledHiddenFieldVisible:
|
||||
case EventType.Cipher_ClientToggledPasswordVisible:
|
||||
case EventType.Cipher_ClientViewed:
|
||||
if(!eventModel.CipherId.HasValue)
|
||||
if (!eventModel.CipherId.HasValue)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Cipher cipher = null;
|
||||
if(ciphersCache.ContainsKey(eventModel.CipherId.Value))
|
||||
if (ciphersCache.ContainsKey(eventModel.CipherId.Value))
|
||||
{
|
||||
cipher = ciphersCache[eventModel.CipherId.Value];
|
||||
}
|
||||
@@ -80,11 +80,11 @@ namespace Bit.Events.Controllers
|
||||
cipher = await _cipherRepository.GetByIdAsync(eventModel.CipherId.Value,
|
||||
_currentContext.UserId.Value);
|
||||
}
|
||||
if(cipher == null)
|
||||
if (cipher == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(!ciphersCache.ContainsKey(eventModel.CipherId.Value))
|
||||
if (!ciphersCache.ContainsKey(eventModel.CipherId.Value))
|
||||
{
|
||||
ciphersCache.Add(eventModel.CipherId.Value, cipher);
|
||||
}
|
||||
@@ -94,9 +94,9 @@ namespace Bit.Events.Controllers
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(cipherEvents.Any())
|
||||
if (cipherEvents.Any())
|
||||
{
|
||||
foreach(var eventsBatch in cipherEvents.Batch(50))
|
||||
foreach (var eventsBatch in cipherEvents.Batch(50))
|
||||
{
|
||||
await _eventService.LogCipherEventsAsync(eventsBatch);
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@ namespace Bit.Events
|
||||
logging.AddSerilog(hostingContext, e =>
|
||||
{
|
||||
var context = e.Properties["SourceContext"].ToString();
|
||||
if(context.Contains("IdentityServer4.Validation.TokenValidator") ||
|
||||
if (context.Contains("IdentityServer4.Validation.TokenValidator") ||
|
||||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
|
||||
{
|
||||
return e.Level > LogEventLevel.Error;
|
||||
}
|
||||
|
||||
if(e.Properties.ContainsKey("RequestPath") &&
|
||||
if (e.Properties.ContainsKey("RequestPath") &&
|
||||
!string.IsNullOrWhiteSpace(e.Properties["RequestPath"]?.ToString()) &&
|
||||
(context.Contains(".Server.Kestrel") || context.Contains(".Core.IISHttpServer")))
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Bit.Events
|
||||
// Services
|
||||
var usingServiceBusAppCache = CoreHelpers.SettingHasValue(globalSettings.ServiceBus.ConnectionString) &&
|
||||
CoreHelpers.SettingHasValue(globalSettings.ServiceBus.ApplicationCacheTopicName);
|
||||
if(usingServiceBusAppCache)
|
||||
if (usingServiceBusAppCache)
|
||||
{
|
||||
services.AddSingleton<IApplicationCacheService, InMemoryServiceBusApplicationCacheService>();
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace Bit.Events
|
||||
services.AddSingleton<IApplicationCacheService, InMemoryApplicationCacheService>();
|
||||
}
|
||||
services.AddScoped<IEventService, EventService>();
|
||||
if(!globalSettings.SelfHosted && CoreHelpers.SettingHasValue(globalSettings.Events.ConnectionString))
|
||||
if (!globalSettings.SelfHosted && CoreHelpers.SettingHasValue(globalSettings.Events.ConnectionString))
|
||||
{
|
||||
services.AddSingleton<IEventWriteService, AzureQueueEventWriteService>();
|
||||
}
|
||||
@@ -75,7 +75,7 @@ namespace Bit.Events
|
||||
config.Filters.Add(new LoggingExceptionHandlerFilterAttribute());
|
||||
});
|
||||
|
||||
if(usingServiceBusAppCache)
|
||||
if (usingServiceBusAppCache)
|
||||
{
|
||||
services.AddHostedService<Core.HostedServices.ApplicationCacheHostedService>();
|
||||
}
|
||||
@@ -89,7 +89,7 @@ namespace Bit.Events
|
||||
{
|
||||
app.UseSerilog(env, appLifetime, globalSettings);
|
||||
|
||||
if(env.IsDevelopment())
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user