#nullable enable using System.Security.Claims; using Bit.Core.AdminConsole.Context; using Bit.Core.AdminConsole.Repositories; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Identity; using Bit.Core.Repositories; using Bit.Core.Settings; using Microsoft.AspNetCore.Http; namespace Bit.Core.Context; public interface ICurrentContext { HttpContext HttpContext { get; set; } Guid? UserId { get; set; } User User { get; set; } string DeviceIdentifier { get; set; } DeviceType? DeviceType { get; set; } string IpAddress { get; set; } List Organizations { get; set; } Guid? InstallationId { get; set; } Guid? OrganizationId { get; set; } ClientType ClientType { get; set; } bool IsBot { get; set; } bool MaybeBot { get; set; } int? BotScore { get; set; } string ClientId { get; set; } Version ClientVersion { get; set; } Task BuildAsync(HttpContext httpContext, GlobalSettings globalSettings); Task BuildAsync(ClaimsPrincipal user, GlobalSettings globalSettings); Task SetContextAsync(ClaimsPrincipal user); Task OrganizationUser(Guid orgId); Task OrganizationManager(Guid orgId); Task OrganizationAdmin(Guid orgId); Task OrganizationOwner(Guid orgId); Task OrganizationCustom(Guid orgId); Task AccessEventLogs(Guid orgId); Task AccessImportExport(Guid orgId); Task AccessReports(Guid orgId); Task EditAnyCollection(Guid orgId); Task ViewAllCollections(Guid orgId); Task EditAssignedCollections(Guid orgId); Task DeleteAssignedCollections(Guid orgId); Task ViewAssignedCollections(Guid orgId); Task ManageGroups(Guid orgId); Task ManagePolicies(Guid orgId); Task ManageSso(Guid orgId); Task ManageUsers(Guid orgId); Task ManageScim(Guid orgId); Task ManageResetPassword(Guid orgId); Task ViewSubscription(Guid orgId); Task EditSubscription(Guid orgId); Task EditPaymentMethods(Guid orgId); Task ViewBillingHistory(Guid orgId); Task ProviderUserForOrgAsync(Guid orgId); bool ProviderProviderAdmin(Guid providerId); bool ProviderUser(Guid providerId); bool ProviderManageUsers(Guid providerId); bool ProviderAccessEventLogs(Guid providerId); bool AccessProviderOrganizations(Guid providerId); bool ManageProviderOrganizations(Guid providerId); Task> OrganizationMembershipAsync( IOrganizationUserRepository organizationUserRepository, Guid userId); Task> ProviderMembershipAsync( IProviderUserRepository providerUserRepository, Guid userId); Task ProviderIdForOrg(Guid orgId); bool AccessSecretsManager(Guid organizationId); CurrentContextOrganization? GetOrganization(Guid orgId); }