1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

Turn on file scoped namespaces (#2225)

This commit is contained in:
Justin Baur 2022-08-29 14:53:16 -04:00 committed by GitHub
parent 7c4521e0b4
commit 34fb4cca2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1206 changed files with 73816 additions and 75022 deletions

View File

@ -114,6 +114,9 @@ csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
# Namespace settigns
csharp_style_namespace_declarations = file_scoped:warning
# All files
[*]
guidelines = 120

View File

@ -13,8 +13,8 @@ using Bit.Core.Settings;
using Bit.Core.Utilities;
using Microsoft.AspNetCore.DataProtection;
namespace Bit.Commercial.Core.Services
{
namespace Bit.Commercial.Core.Services;
public class ProviderService : IProviderService
{
public static PlanType[] ProviderDisllowedOrganizationTypes = new[] { PlanType.Free, PlanType.FamiliesAnnually, PlanType.FamiliesAnnually2019 };
@ -506,4 +506,3 @@ namespace Bit.Commercial.Core.Services
}
}
}
}

View File

@ -2,8 +2,8 @@
using Bit.Core.Services;
using Microsoft.Extensions.DependencyInjection;
namespace Bit.Commercial.Core.Utilities
{
namespace Bit.Commercial.Core.Utilities;
public static class ServiceCollectionExtensions
{
public static void AddCommCoreServices(this IServiceCollection services)
@ -11,4 +11,3 @@ namespace Bit.Commercial.Core.Utilities
services.AddScoped<IProviderService, ProviderService>();
}
}
}

View File

@ -4,8 +4,8 @@ using Bit.Core.Models.OrganizationConnectionConfigs;
using Bit.Core.Repositories;
using Bit.Core.Settings;
namespace Bit.Scim.Context
{
namespace Bit.Scim.Context;
public interface IScimContext
{
ScimProviderType RequestScimProvider { get; set; }
@ -18,4 +18,3 @@ namespace Bit.Scim.Context
IOrganizationRepository organizationRepository,
IOrganizationConnectionRepository organizationConnectionRepository);
}
}

View File

@ -4,8 +4,8 @@ using Bit.Core.Models.OrganizationConnectionConfigs;
using Bit.Core.Repositories;
using Bit.Core.Settings;
namespace Bit.Scim.Context
{
namespace Bit.Scim.Context;
public class ScimContext : IScimContext
{
private bool _builtHttpContext;
@ -61,4 +61,3 @@ namespace Bit.Scim.Context
}
}
}
}

View File

@ -2,8 +2,8 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Scim.Controllers
{
namespace Bit.Scim.Controllers;
[AllowAnonymous]
public class InfoController : Controller
{
@ -20,4 +20,3 @@ namespace Bit.Scim.Controllers
return Json(CoreHelpers.GetVersion());
}
}
}

View File

@ -8,8 +8,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
namespace Bit.Scim.Controllers.v2
{
namespace Bit.Scim.Controllers.v2;
[Authorize("Scim")]
[Route("v2/{organizationId}/groups")]
public class GroupsController : Controller
@ -325,4 +325,3 @@ namespace Bit.Scim.Controllers.v2
await _groupRepository.UpdateUsersAsync(group.Id, memberIds);
}
}
}

View File

@ -9,8 +9,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
namespace Bit.Scim.Controllers.v2
{
namespace Bit.Scim.Controllers.v2;
[Authorize("Scim")]
[Route("v2/{organizationId}/users")]
public class UsersController : Controller
@ -292,4 +292,3 @@ namespace Bit.Scim.Controllers.v2
return false;
}
}
}

View File

@ -1,7 +1,7 @@
using Bit.Scim.Utilities;
namespace Bit.Scim.Models
{
namespace Bit.Scim.Models;
public abstract class BaseScimGroupModel : BaseScimModel
{
public BaseScimGroupModel(bool initSchema = false)
@ -15,4 +15,3 @@ namespace Bit.Scim.Models
public string DisplayName { get; set; }
public string ExternalId { get; set; }
}
}

View File

@ -1,5 +1,5 @@
namespace Bit.Scim.Models
{
namespace Bit.Scim.Models;
public abstract class BaseScimModel
{
public BaseScimModel()
@ -12,4 +12,3 @@
public List<string> Schemas { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using Bit.Scim.Utilities;
namespace Bit.Scim.Models
{
namespace Bit.Scim.Models;
public abstract class BaseScimUserModel : BaseScimModel
{
public BaseScimUserModel(bool initSchema = false)
@ -53,4 +53,3 @@ namespace Bit.Scim.Models
public string Type { get; set; }
}
}
}

View File

@ -1,7 +1,7 @@
using Bit.Scim.Utilities;
namespace Bit.Scim.Models
{
namespace Bit.Scim.Models;
public class ScimErrorResponseModel : BaseScimModel
{
public ScimErrorResponseModel()
@ -11,4 +11,3 @@ namespace Bit.Scim.Models
public string Detail { get; set; }
public int Status { get; set; }
}
}

View File

@ -1,8 +1,8 @@
using Bit.Core.Entities;
using Bit.Core.Utilities;
namespace Bit.Scim.Models
{
namespace Bit.Scim.Models;
public class ScimGroupRequestModel : BaseScimGroupModel
{
public ScimGroupRequestModel()
@ -28,4 +28,3 @@ namespace Bit.Scim.Models
public string Display { get; set; }
}
}
}

View File

@ -1,7 +1,7 @@
using Bit.Core.Entities;
namespace Bit.Scim.Models
{
namespace Bit.Scim.Models;
public class ScimGroupResponseModel : BaseScimGroupModel
{
public ScimGroupResponseModel()
@ -23,4 +23,3 @@ namespace Bit.Scim.Models
public string Id { get; set; }
public ScimMetaModel Meta { get; private set; }
}
}

View File

@ -1,7 +1,7 @@
using Bit.Scim.Utilities;
namespace Bit.Scim.Models
{
namespace Bit.Scim.Models;
public class ScimListResponseModel<T> : BaseScimModel
{
public ScimListResponseModel()
@ -13,4 +13,3 @@ namespace Bit.Scim.Models
public int ItemsPerPage { get; set; }
public List<T> Resources { get; set; }
}
}

View File

@ -1,5 +1,5 @@
namespace Bit.Scim.Models
{
namespace Bit.Scim.Models;
public class ScimMetaModel
{
public ScimMetaModel(string resourceType)
@ -11,4 +11,3 @@
public DateTime? Created { get; set; }
public DateTime? LastModified { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using System.Text.Json;
namespace Bit.Scim.Models
{
namespace Bit.Scim.Models;
public class ScimPatchModel : BaseScimModel
{
public ScimPatchModel()
@ -16,4 +16,3 @@ namespace Bit.Scim.Models
public JsonElement Value { get; set; }
}
}
}

View File

@ -1,9 +1,8 @@
namespace Bit.Scim.Models
{
namespace Bit.Scim.Models;
public class ScimUserRequestModel : BaseScimUserModel
{
public ScimUserRequestModel()
: base(false)
{ }
}
}

View File

@ -1,7 +1,7 @@
using Bit.Core.Models.Data.Organizations.OrganizationUsers;
namespace Bit.Scim.Models
{
namespace Bit.Scim.Models;
public class ScimUserResponseModel : BaseScimUserModel
{
public ScimUserResponseModel()
@ -26,4 +26,3 @@ namespace Bit.Scim.Models
public string Id { get; set; }
public ScimMetaModel Meta { get; private set; }
}
}

View File

@ -1,8 +1,8 @@
using Bit.Core.Utilities;
using Serilog.Events;
namespace Bit.Scim
{
namespace Bit.Scim;
public class Program
{
public static void Main(string[] args)
@ -31,4 +31,3 @@ namespace Bit.Scim
.Run();
}
}
}

View File

@ -1,6 +1,5 @@
namespace Bit.Scim
{
namespace Bit.Scim;
public class ScimSettings
{
}
}

View File

@ -9,8 +9,8 @@ using IdentityModel;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Stripe;
namespace Bit.Scim
{
namespace Bit.Scim;
public class Startup
{
public Startup(IWebHostEnvironment env, IConfiguration configuration)
@ -113,4 +113,3 @@ namespace Bit.Scim
app.UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute());
}
}
}

View File

@ -8,8 +8,8 @@ using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
namespace Bit.Scim.Utilities
{
namespace Bit.Scim.Utilities;
public class ApiKeyAuthenticationHandler : AuthenticationHandler<ApiKeyAuthenticationOptions>
{
private readonly IOrganizationRepository _organizationRepository;
@ -87,4 +87,3 @@ namespace Bit.Scim.Utilities
return AuthenticateResult.Success(ticket);
}
}
}

View File

@ -1,9 +1,8 @@
using Microsoft.AspNetCore.Authentication;
namespace Bit.Scim.Utilities
{
namespace Bit.Scim.Utilities;
public class ApiKeyAuthenticationOptions : AuthenticationSchemeOptions
{
public const string DefaultScheme = "ScimApiKey";
}
}

View File

@ -1,5 +1,5 @@
namespace Bit.Scim.Utilities
{
namespace Bit.Scim.Utilities;
public static class ScimConstants
{
public const string Scim2SchemaListResponse = "urn:ietf:params:scim:api:messages:2.0:ListResponse";
@ -7,4 +7,3 @@
public const string Scim2SchemaUser = "urn:ietf:params:scim:schemas:core:2.0:User";
public const string Scim2SchemaGroup = "urn:ietf:params:scim:schemas:core:2.0:Group";
}
}

View File

@ -2,8 +2,8 @@
using Bit.Core.Settings;
using Bit.Scim.Context;
namespace Bit.Scim.Utilities
{
namespace Bit.Scim.Utilities;
public class ScimContextMiddleware
{
private readonly RequestDelegate _next;
@ -20,4 +20,3 @@ namespace Bit.Scim.Utilities
await _next.Invoke(httpContext);
}
}
}

View File

@ -22,8 +22,8 @@ using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Sso.Controllers
{
namespace Bit.Sso.Controllers;
public class AccountController : Controller
{
private readonly IAuthenticationSchemeProvider _schemeProvider;
@ -707,4 +707,3 @@ namespace Bit.Sso.Controllers
&& !context.RedirectUri.StartsWith("http", StringComparison.Ordinal);
}
}
}

View File

@ -5,8 +5,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Sso.Controllers
{
namespace Bit.Sso.Controllers;
public class HomeController : Controller
{
private readonly IIdentityServerInteractionService _interaction;
@ -52,4 +52,3 @@ namespace Bit.Sso.Controllers
return View("Error", vm);
}
}
}

View File

@ -1,8 +1,8 @@
using Bit.Core.Utilities;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Sso.Controllers
{
namespace Bit.Sso.Controllers;
public class InfoController : Controller
{
[HttpGet("~/alive")]
@ -18,4 +18,3 @@ namespace Bit.Sso.Controllers
return Json(CoreHelpers.GetVersion());
}
}
}

View File

@ -5,8 +5,8 @@ using Microsoft.AspNetCore.Mvc;
using Sustainsys.Saml2.AspNetCore2;
using Sustainsys.Saml2.WebSso;
namespace Bit.Sso.Controllers
{
namespace Bit.Sso.Controllers;
public class MetadataController : Controller
{
private readonly IAuthenticationSchemeProvider _schemeProvider;
@ -67,4 +67,3 @@ namespace Bit.Sso.Controllers
};
}
}
}

View File

@ -1,7 +1,7 @@
using IdentityServer4.Models;
namespace Bit.Sso.Models
{
namespace Bit.Sso.Models;
public class ErrorViewModel
{
private string _requestId;
@ -24,4 +24,3 @@ namespace Bit.Sso.Models
}
}
}
}

View File

@ -1,7 +1,6 @@
namespace Bit.Sso.Models
{
namespace Bit.Sso.Models;
public class RedirectViewModel
{
public string RedirectUrl { get; set; }
}
}

View File

@ -1,9 +1,8 @@
using System.Security.Cryptography.X509Certificates;
namespace Bit.Sso.Models
{
namespace Bit.Sso.Models;
public class SamlEnvironment
{
public X509Certificate2 SpSigningCertificate { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Mvc;
namespace Bit.Sso.Models
{
namespace Bit.Sso.Models;
public class SsoPreValidateResponseModel : JsonResult
{
public SsoPreValidateResponseModel(string token) : base(new
@ -10,4 +10,3 @@ namespace Bit.Sso.Models
})
{ }
}
}

View File

@ -2,8 +2,8 @@
using Serilog;
using Serilog.Events;
namespace Bit.Sso
{
namespace Bit.Sso;
public class Program
{
public static void Main(string[] args)
@ -31,4 +31,3 @@ namespace Bit.Sso
.Run();
}
}
}

View File

@ -8,8 +8,8 @@ using IdentityServer4.Extensions;
using Microsoft.IdentityModel.Logging;
using Stripe;
namespace Bit.Sso
{
namespace Bit.Sso;
public class Startup
{
public Startup(IWebHostEnvironment env, IConfiguration configuration)
@ -152,4 +152,3 @@ namespace Bit.Sso
logger.LogInformation(Constants.BypassFiltersEventId, globalSettings.ProjectName + " started.");
}
}
}

View File

@ -1,8 +1,8 @@
using System.Security.Claims;
using System.Text.RegularExpressions;
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public static class ClaimsExtensions
{
private static readonly Regex _normalizeTextRegEx =
@ -43,4 +43,3 @@ namespace Bit.Sso.Utilities
return _normalizeTextRegEx.Replace(text, string.Empty);
}
}
}

View File

@ -5,8 +5,8 @@ using IdentityServer4.Services;
using IdentityServer4.Stores;
using IdentityServer4.Validation;
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public class DiscoveryResponseGenerator : IdentityServer4.ResponseHandling.DiscoveryResponseGenerator
{
private readonly GlobalSettings _globalSettings;
@ -33,4 +33,3 @@ namespace Bit.Sso.Utilities
_globalSettings.BaseServiceUri.InternalSso);
}
}
}

View File

@ -3,8 +3,8 @@ using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Sustainsys.Saml2.AspNetCore2;
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public class DynamicAuthenticationScheme : AuthenticationScheme, IDynamicAuthenticationScheme
{
public DynamicAuthenticationScheme(string name, string displayName, Type handlerType,
@ -87,4 +87,3 @@ namespace Bit.Sso.Utilities
}
}
}
}

View File

@ -18,8 +18,8 @@ using Sustainsys.Saml2.AspNetCore2;
using Sustainsys.Saml2.Configuration;
using Sustainsys.Saml2.Saml2P;
namespace Bit.Core.Business.Sso
{
namespace Bit.Core.Business.Sso;
public class DynamicAuthenticationSchemeProvider : AuthenticationSchemeProvider
{
private readonly IPostConfigureOptions<OpenIdConnectOptions> _oidcPostConfigureOptions;
@ -455,4 +455,3 @@ namespace Bit.Core.Business.Sso
};
}
}
}

View File

@ -1,8 +1,8 @@
using System.Collections.Concurrent;
using Microsoft.Extensions.Options;
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public class ExtendedOptionsMonitorCache<TOptions> : IExtendedOptionsMonitorCache<TOptions> where TOptions : class
{
private readonly ConcurrentDictionary<string, Lazy<TOptions>> _cache =
@ -34,4 +34,3 @@ namespace Bit.Sso.Utilities
return _cache.TryRemove(name ?? Options.DefaultName, out _);
}
}
}

View File

@ -1,8 +1,8 @@
using Bit.Core.Enums;
using Microsoft.AspNetCore.Authentication;
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public interface IDynamicAuthenticationScheme
{
AuthenticationSchemeOptions Options { get; set; }
@ -10,4 +10,3 @@ namespace Bit.Sso.Utilities
Task Validate();
}
}

View File

@ -1,9 +1,8 @@
using Microsoft.Extensions.Options;
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public interface IExtendedOptionsMonitorCache<TOptions> : IOptionsMonitorCache<TOptions> where TOptions : class
{
void AddOrUpdate(string name, TOptions options);
}
}

View File

@ -1,8 +1,8 @@
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public static class OpenIdConnectOptionsExtensions
{
public static async Task<bool> CouldHandleAsync(this OpenIdConnectOptions options, string scheme, HttpContext context)
@ -60,4 +60,3 @@ namespace Bit.Sso.Utilities
return false;
}
}
}

View File

@ -1,5 +1,5 @@
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
/// <summary>
/// OpenID Connect Clients use scope values as defined in 3.3 of OAuth 2.0
/// [RFC6749]. These values represent the standard scope values supported
@ -61,4 +61,3 @@
/// </remarks>
public const string Acr = "acr";
}
}

View File

@ -4,8 +4,8 @@ using System.Xml;
using Sustainsys.Saml2;
using Sustainsys.Saml2.AspNetCore2;
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public static class Saml2OptionsExtensions
{
public static async Task<bool> CouldHandleAsync(this Saml2Options options, string scheme, HttpContext context)
@ -102,4 +102,3 @@ namespace Bit.Sso.Utilities
return true;
}
}
}

View File

@ -1,5 +1,5 @@
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public static class SamlClaimTypes
{
public const string Email = "urn:oid:0.9.2342.19200300.100.1.3";
@ -9,4 +9,3 @@
public const string CommonName = "urn:oid:2.5.4.3";
public const string UserId = "urn:oid:0.9.2342.19200300.100.1.1";
}
}

View File

@ -1,5 +1,5 @@
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public static class SamlNameIdFormats
{
// Common
@ -15,4 +15,3 @@
public const string KerberosPrincipalName = "urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos";
public const string EntityIdentifier = "urn:oasis:names:tc:SAML:2.0:nameid-format:entity";
}
}

View File

@ -1,7 +1,6 @@
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public static class SamlPropertyKeys
{
public const string ClaimFormat = "http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format";
}
}

View File

@ -9,8 +9,8 @@ using IdentityServer4.ResponseHandling;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Sustainsys.Saml2.AspNetCore2;
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddSsoServices(this IServiceCollection services,
@ -75,4 +75,3 @@ namespace Bit.Sso.Utilities
return identityServerBuilder;
}
}
}

View File

@ -3,8 +3,8 @@ using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Sustainsys.Saml2.AspNetCore2;
namespace Bit.Sso.Utilities
{
namespace Bit.Sso.Utilities;
public class SsoAuthenticationMiddleware
{
private readonly RequestDelegate _next;
@ -82,4 +82,3 @@ namespace Bit.Sso.Utilities
await _next(context);
}
}
}

View File

@ -3,8 +3,8 @@ using AutoFixture;
using AutoFixture.Xunit2;
using Bit.Core.Enums.Provider;
namespace Bit.Commercial.Core.Test.AutoFixture
{
namespace Bit.Commercial.Core.Test.AutoFixture;
internal class ProviderUser : ICustomization
{
public ProviderUserStatusType Status { get; set; }
@ -42,4 +42,3 @@ namespace Bit.Commercial.Core.Test.AutoFixture
return new ProviderUser(_status, _type);
}
}
}

View File

@ -19,8 +19,8 @@ using NSubstitute.ReturnsExtensions;
using Xunit;
using ProviderUser = Bit.Core.Entities.Provider.ProviderUser;
namespace Bit.Commercial.Core.Test.Services
{
namespace Bit.Commercial.Core.Test.Services;
public class ProviderServiceTests
{
[Theory, CustomAutoData(typeof(SutProviderCustomization))]
@ -547,4 +547,3 @@ namespace Bit.Commercial.Core.Test.Services
.LogProviderOrganizationEventAsync(providerOrganization, EventType.ProviderOrganization_Removed);
}
}
}

View File

@ -1,5 +1,5 @@
namespace Bit.Admin
{
namespace Bit.Admin;
public class AdminSettings
{
public virtual string Admins { get; set; }
@ -13,4 +13,3 @@
public string AuthKey { get; set; }
}
}
}

View File

@ -1,8 +1,8 @@
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Admin.Controllers
{
namespace Bit.Admin.Controllers;
public class ErrorController : Controller
{
[Route("/error")]
@ -21,4 +21,3 @@ namespace Bit.Admin.Controllers
}
}
}
}

View File

@ -6,8 +6,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace Bit.Admin.Controllers
{
namespace Bit.Admin.Controllers;
public class HomeController : Controller
{
private readonly GlobalSettings _globalSettings;
@ -111,4 +111,3 @@ namespace Bit.Admin.Controllers
Core,
Web,
}
}

View File

@ -1,8 +1,8 @@
using Bit.Core.Utilities;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Admin.Controllers
{
namespace Bit.Admin.Controllers;
public class InfoController : Controller
{
[HttpGet("~/alive")]
@ -18,4 +18,3 @@ namespace Bit.Admin.Controllers
return Json(CoreHelpers.GetVersion());
}
}
}

View File

@ -3,8 +3,8 @@ using Bit.Core.Identity;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Admin.Controllers
{
namespace Bit.Admin.Controllers;
public class LoginController : Controller
{
private readonly PasswordlessSignInManager<IdentityUser> _signInManager;
@ -90,4 +90,3 @@ namespace Bit.Admin.Controllers
};
}
}
}

View File

@ -7,8 +7,8 @@ using Microsoft.Azure.Cosmos;
using Microsoft.Azure.Cosmos.Linq;
using Serilog.Events;
namespace Bit.Admin.Controllers
{
namespace Bit.Admin.Controllers;
[Authorize]
[SelfHosted(NotSelfHostedOnly = true)]
public class LogsController : Controller
@ -90,4 +90,3 @@ namespace Bit.Admin.Controllers
}
}
}
}

View File

@ -11,8 +11,8 @@ using Bit.Core.Utilities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Admin.Controllers
{
namespace Bit.Admin.Controllers;
[Authorize]
public class OrganizationsController : Controller
{
@ -214,4 +214,3 @@ namespace Bit.Admin.Controllers
}
}
}

View File

@ -7,8 +7,8 @@ using Bit.Core.Utilities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Admin.Controllers
{
namespace Bit.Admin.Controllers;
[Authorize]
[SelfHosted(NotSelfHostedOnly = true)]
public class ProvidersController : Controller
@ -131,4 +131,3 @@ namespace Bit.Admin.Controllers
return RedirectToAction("Edit", new { id = providerId });
}
}
}

View File

@ -10,8 +10,8 @@ using Bit.Core.Utilities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Admin.Controllers
{
namespace Bit.Admin.Controllers;
[Authorize]
[SelfHosted(NotSelfHostedOnly = true)]
public class ToolsController : Controller
@ -556,4 +556,3 @@ namespace Bit.Admin.Controllers
return File(bytes, "application/json", "StripeSubscriptionsSearch.json");
}
}
}

View File

@ -7,8 +7,8 @@ using Bit.Core.Utilities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Bit.Admin.Controllers
{
namespace Bit.Admin.Controllers;
[Authorize]
public class UsersController : Controller
{
@ -108,4 +108,3 @@ namespace Bit.Admin.Controllers
return RedirectToAction("Index");
}
}
}

View File

@ -4,8 +4,8 @@ using Amazon.SQS.Model;
using Bit.Core.Settings;
using Microsoft.Extensions.Options;
namespace Bit.Admin.HostedServices
{
namespace Bit.Admin.HostedServices;
public class AmazonSqsBlockIpHostedService : BlockIpHostedService
{
private AmazonSQSClient _client;
@ -81,4 +81,3 @@ namespace Bit.Admin.HostedServices
}
}
}
}

View File

@ -2,8 +2,8 @@
using Bit.Core.Settings;
using Microsoft.Extensions.Options;
namespace Bit.Admin.HostedServices
{
namespace Bit.Admin.HostedServices;
public class AzureQueueBlockIpHostedService : BlockIpHostedService
{
private QueueClient _blockIpQueueClient;
@ -61,4 +61,3 @@ namespace Bit.Admin.HostedServices
}
}
}
}

View File

@ -6,8 +6,8 @@ using Bit.Core.Services;
using Bit.Core.Settings;
using Bit.Core.Utilities;
namespace Bit.Admin.HostedServices
{
namespace Bit.Admin.HostedServices;
public class AzureQueueMailHostedService : IHostedService
{
private readonly ILogger<AzureQueueMailHostedService> _logger;
@ -99,4 +99,3 @@ namespace Bit.Admin.HostedServices
return (await _mailQueueClient.ReceiveMessagesAsync(maxMessages: 32))?.Value ?? new QueueMessage[] { };
}
}
}

View File

@ -1,8 +1,8 @@
using Bit.Core.Settings;
using Microsoft.Extensions.Options;
namespace Bit.Admin.HostedServices
{
namespace Bit.Admin.HostedServices;
public abstract class BlockIpHostedService : IHostedService, IDisposable
{
protected readonly ILogger<BlockIpHostedService> _logger;
@ -162,4 +162,3 @@ namespace Bit.Admin.HostedServices
}
}
}
}

View File

@ -3,8 +3,8 @@ using Bit.Core.Jobs;
using Bit.Core.Settings;
using Bit.Migrator;
namespace Bit.Admin.HostedServices
{
namespace Bit.Admin.HostedServices;
public class DatabaseMigrationHostedService : IHostedService, IDisposable
{
private readonly GlobalSettings _globalSettings;
@ -61,4 +61,3 @@ namespace Bit.Admin.HostedServices
public virtual void Dispose()
{ }
}
}

View File

@ -3,8 +3,8 @@ using Bit.Core.Jobs;
using Bit.Core.Settings;
using Quartz;
namespace Bit.Admin.Jobs
{
namespace Bit.Admin.Jobs;
public class AliveJob : BaseJob
{
private readonly GlobalSettings _globalSettings;
@ -26,4 +26,3 @@ namespace Bit.Admin.Jobs
response.StatusCode);
}
}
}

View File

@ -3,8 +3,8 @@ using Bit.Core.Jobs;
using Bit.Core.Repositories;
using Quartz;
namespace Bit.Admin.Jobs
{
namespace Bit.Admin.Jobs;
public class DatabaseExpiredGrantsJob : BaseJob
{
private readonly IMaintenanceRepository _maintenanceRepository;
@ -24,4 +24,3 @@ namespace Bit.Admin.Jobs
_logger.LogInformation(Constants.BypassFiltersEventId, "Finished job task: DeleteExpiredGrantsAsync");
}
}
}

View File

@ -4,8 +4,8 @@ using Bit.Core.Repositories;
using Bit.Core.Settings;
using Quartz;
namespace Bit.Admin.Jobs
{
namespace Bit.Admin.Jobs;
public class DatabaseExpiredSponsorshipsJob : BaseJob
{
private GlobalSettings _globalSettings;
@ -36,4 +36,3 @@ namespace Bit.Admin.Jobs
_logger.LogInformation(Constants.BypassFiltersEventId, "Finished job task: DeleteExpiredSponsorshipsAsync");
}
}
}

View File

@ -3,8 +3,8 @@ using Bit.Core.Jobs;
using Bit.Core.Repositories;
using Quartz;
namespace Bit.Admin.Jobs
{
namespace Bit.Admin.Jobs;
public class DatabaseRebuildlIndexesJob : BaseJob
{
private readonly IMaintenanceRepository _maintenanceRepository;
@ -24,4 +24,3 @@ namespace Bit.Admin.Jobs
_logger.LogInformation(Constants.BypassFiltersEventId, "Finished job task: RebuildIndexesAsync");
}
}
}

View File

@ -3,8 +3,8 @@ using Bit.Core.Jobs;
using Bit.Core.Repositories;
using Quartz;
namespace Bit.Admin.Jobs
{
namespace Bit.Admin.Jobs;
public class DatabaseUpdateStatisticsJob : BaseJob
{
private readonly IMaintenanceRepository _maintenanceRepository;
@ -27,4 +27,3 @@ namespace Bit.Admin.Jobs
_logger.LogInformation(Constants.BypassFiltersEventId, "Finished job task: DisableCipherAutoStatsAsync");
}
}
}

View File

@ -4,8 +4,8 @@ using Bit.Core.Repositories;
using Microsoft.Extensions.Options;
using Quartz;
namespace Bit.Admin.Jobs
{
namespace Bit.Admin.Jobs;
public class DeleteCiphersJob : BaseJob
{
private readonly ICipherRepository _cipherRepository;
@ -34,4 +34,3 @@ namespace Bit.Admin.Jobs
_logger.LogInformation(Constants.BypassFiltersEventId, "Finished job task: DeleteDeletedAsync");
}
}
}

View File

@ -4,8 +4,8 @@ using Bit.Core.Repositories;
using Bit.Core.Services;
using Quartz;
namespace Bit.Admin.Jobs
{
namespace Bit.Admin.Jobs;
public class DeleteSendsJob : BaseJob
{
private readonly ISendRepository _sendRepository;
@ -39,4 +39,3 @@ namespace Bit.Admin.Jobs
}
}
}
}

View File

@ -3,8 +3,8 @@ using Bit.Core.Jobs;
using Bit.Core.Settings;
using Quartz;
namespace Bit.Admin.Jobs
{
namespace Bit.Admin.Jobs;
public class JobsHostedService : BaseJobsHostedService
{
public JobsHostedService(
@ -93,4 +93,3 @@ namespace Bit.Admin.Jobs
services.AddTransient<DeleteCiphersJob>();
}
}
}

View File

@ -1,11 +1,10 @@
using Bit.Core.Models.Business;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class BillingInformationModel
{
public BillingInfo BillingInfo { get; set; }
public Guid? UserId { get; set; }
public Guid? OrganizationId { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class ChargeBraintreeModel : IValidatableObject
{
[Required]
@ -25,4 +25,3 @@ namespace Bit.Admin.Models
}
}
}
}

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class CreateProviderModel
{
public CreateProviderModel() { }
@ -10,4 +10,3 @@ namespace Bit.Admin.Models
[Required]
public string OwnerEmail { get; set; }
}
}

View File

@ -2,8 +2,8 @@
using Bit.Core.Entities;
using Bit.Core.Enums;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class CreateUpdateTransactionModel : IValidatableObject
{
public CreateUpdateTransactionModel() { }
@ -75,4 +75,3 @@ namespace Bit.Admin.Models
};
}
}
}

View File

@ -1,5 +1,5 @@
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class CursorPagedModel<T>
{
public List<T> Items { get; set; }
@ -7,4 +7,3 @@
public string Cursor { get; set; }
public string NextCursor { get; set; }
}
}

View File

@ -1,9 +1,8 @@
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class ErrorViewModel
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
}

View File

@ -1,10 +1,9 @@
using Bit.Core.Settings;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class HomeModel
{
public string CurrentVersion { get; set; }
public GlobalSettings GlobalSettings { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class LicenseModel : IValidatableObject
{
[Display(Name = "User Id")]
@ -32,4 +32,3 @@ namespace Bit.Admin.Models
}
}
}
}

View File

@ -1,8 +1,8 @@
using Microsoft.Azure.Documents;
using Newtonsoft.Json.Linq;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class LogModel : Resource
{
public long EventIdHash { get; set; }
@ -52,4 +52,3 @@ namespace Bit.Admin.Models
return val;
}
}
}

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class LoginModel
{
[Required]
@ -11,4 +11,3 @@ namespace Bit.Admin.Models
public string Error { get; set; }
public string Success { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using Serilog.Events;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class LogsModel : CursorPagedModel<LogModel>
{
public LogEventLevel? Level { get; set; }
@ -9,4 +9,3 @@ namespace Bit.Admin.Models
public DateTime? Start { get; set; }
public DateTime? End { get; set; }
}
}

View File

@ -6,8 +6,8 @@ using Bit.Core.Models.Data.Organizations.OrganizationUsers;
using Bit.Core.Settings;
using Bit.Core.Utilities;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class OrganizationEditModel : OrganizationViewModel
{
public OrganizationEditModel() { }
@ -150,4 +150,3 @@ namespace Bit.Admin.Models
return existingOrganization;
}
}
}

View File

@ -2,8 +2,8 @@
using Bit.Core.Enums;
using Bit.Core.Models.Data.Organizations.OrganizationUsers;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class OrganizationViewModel
{
public OrganizationViewModel() { }
@ -47,4 +47,3 @@ namespace Bit.Admin.Models
public int PolicyCount { get; set; }
public bool HasPublicPrivateKeys { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using Bit.Core.Entities;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class OrganizationsModel : PagedModel<Organization>
{
public string Name { get; set; }
@ -10,4 +10,3 @@ namespace Bit.Admin.Models
public string Action { get; set; }
public bool SelfHosted { get; set; }
}
}

View File

@ -1,5 +1,5 @@
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public abstract class PagedModel<T>
{
public List<T> Items { get; set; }
@ -8,4 +8,3 @@
public int? PreviousPage => Page < 2 ? (int?)null : Page - 1;
public int? NextPage => Items.Count < Count ? (int?)null : Page + 1;
}
}

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class PromoteAdminModel
{
[Required]
@ -11,4 +11,3 @@ namespace Bit.Admin.Models
[Display(Name = "Organization Id")]
public Guid? OrganizationId { get; set; }
}
}

View File

@ -2,8 +2,8 @@
using Bit.Core.Entities.Provider;
using Bit.Core.Models.Data;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class ProviderEditModel : ProviderViewModel
{
public ProviderEditModel() { }
@ -31,4 +31,3 @@ namespace Bit.Admin.Models
return existingProvider;
}
}
}

View File

@ -2,8 +2,8 @@
using Bit.Core.Enums.Provider;
using Bit.Core.Models.Data;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class ProviderViewModel
{
public ProviderViewModel() { }
@ -22,4 +22,3 @@ namespace Bit.Admin.Models
public IEnumerable<ProviderUserUserDetails> ProviderAdmins { get; set; }
public IEnumerable<ProviderOrganizationOrganizationDetails> ProviderOrganizations { get; set; }
}
}

View File

@ -1,7 +1,7 @@
using Bit.Core.Entities.Provider;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class ProvidersModel : PagedModel<Provider>
{
public string Name { get; set; }
@ -10,4 +10,3 @@ namespace Bit.Admin.Models
public string Action { get; set; }
public bool SelfHosted { get; set; }
}
}

View File

@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations;
using Bit.Core.Models.BitStripe;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class StripeSubscriptionRowModel
{
public Stripe.Subscription Subscription { get; set; }
@ -40,4 +40,3 @@ namespace Bit.Admin.Models
}
}
}
}

View File

@ -1,5 +1,5 @@
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class TaxRateAddEditModel
{
public string StripeTaxRateId { get; set; }
@ -8,4 +8,3 @@
public string PostalCode { get; set; }
public decimal Rate { get; set; }
}
}

View File

@ -1,9 +1,8 @@
using Bit.Core.Entities;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class TaxRatesModel : PagedModel<TaxRate>
{
public string Message { get; set; }
}
}

View File

@ -4,8 +4,8 @@ using Bit.Core.Models.Business;
using Bit.Core.Settings;
using Bit.Core.Utilities;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class UserEditModel : UserViewModel
{
public UserEditModel() { }
@ -71,4 +71,3 @@ namespace Bit.Admin.Models
return existingUser;
}
}
}

View File

@ -1,7 +1,7 @@
using Bit.Core.Entities;
namespace Bit.Admin.Models
{
namespace Bit.Admin.Models;
public class UserViewModel
{
public UserViewModel() { }
@ -15,4 +15,3 @@ namespace Bit.Admin.Models
public User User { get; set; }
public int CipherCount { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More