2023-04-14 11:13:16 +01:00
|
|
|
|
using System.Security.Claims;
|
2023-10-20 06:37:46 +10:00
|
|
|
|
using Bit.Core.AdminConsole.Models.Business;
|
2023-04-14 13:25:56 -04:00
|
|
|
|
using Bit.Core.Auth.Enums;
|
2023-04-14 11:13:16 +01:00
|
|
|
|
using Bit.Core.Entities;
|
2017-04-10 11:49:53 -04:00
|
|
|
|
using Bit.Core.Enums;
|
2017-03-03 00:07:11 -05:00
|
|
|
|
using Bit.Core.Models.Business;
|
2017-05-11 14:52:35 -04:00
|
|
|
|
using Bit.Core.Models.Data;
|
2017-03-03 00:07:11 -05:00
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Services;
|
2022-08-29 16:06:55 -04:00
|
|
|
|
|
2017-03-03 00:07:11 -05:00
|
|
|
|
public interface IOrganizationService
|
|
|
|
|
|
{
|
2020-06-17 19:49:27 -04:00
|
|
|
|
Task ReplacePaymentMethodAsync(Guid organizationId, string paymentToken, PaymentMethodType paymentMethodType,
|
|
|
|
|
|
TaxInfo taxInfo);
|
2018-12-31 13:34:02 -05:00
|
|
|
|
Task CancelSubscriptionAsync(Guid organizationId, bool? endOfPeriod = null);
|
2017-04-10 18:20:21 -04:00
|
|
|
|
Task ReinstateSubscriptionAsync(Guid organizationId);
|
2019-08-10 12:59:32 -04:00
|
|
|
|
Task<string> AdjustStorageAsync(Guid organizationId, short storageAdjustmentGb);
|
2021-09-23 06:36:08 -04:00
|
|
|
|
Task UpdateSubscription(Guid organizationId, int seatAdjustment, int? maxAutoscaleSeats);
|
2021-10-25 10:19:37 -05:00
|
|
|
|
Task AutoAddSeatsAsync(Organization organization, int seatsToAdd, DateTime? prorationDate = null);
|
2021-09-23 06:36:08 -04:00
|
|
|
|
Task<string> AdjustSeatsAsync(Guid organizationId, int seatAdjustment, DateTime? prorationDate = null);
|
2017-08-14 09:23:54 -04:00
|
|
|
|
Task VerifyBankAsync(Guid organizationId, int amount1, int amount2);
|
2021-07-08 17:05:32 +02:00
|
|
|
|
Task<Tuple<Organization, OrganizationUser>> SignUpAsync(OrganizationSignup organizationSignup, bool provider = false);
|
2017-08-30 21:25:46 -04:00
|
|
|
|
Task<Tuple<Organization, OrganizationUser>> SignUpAsync(OrganizationLicense license, User owner,
|
2021-05-06 14:53:12 -05:00
|
|
|
|
string ownerKey, string collectionName, string publicKey, string privateKey);
|
2017-04-11 10:52:28 -04:00
|
|
|
|
Task DeleteAsync(Organization organization);
|
2019-08-09 23:56:26 -04:00
|
|
|
|
Task EnableAsync(Guid organizationId, DateTime? expirationDate);
|
2017-08-12 22:16:42 -04:00
|
|
|
|
Task DisableAsync(Guid organizationId, DateTime? expirationDate);
|
|
|
|
|
|
Task UpdateExpirationDateAsync(Guid organizationId, DateTime? expirationDate);
|
2017-04-26 16:14:15 -04:00
|
|
|
|
Task EnableAsync(Guid organizationId);
|
2017-04-10 19:07:38 -04:00
|
|
|
|
Task UpdateAsync(Organization organization, bool updateBilling = false);
|
2018-04-02 23:18:26 -04:00
|
|
|
|
Task UpdateTwoFactorProviderAsync(Organization organization, TwoFactorProviderType type);
|
|
|
|
|
|
Task DisableTwoFactorProviderAsync(Organization organization, TwoFactorProviderType type);
|
2021-09-23 06:36:08 -04:00
|
|
|
|
Task<List<OrganizationUser>> InviteUsersAsync(Guid organizationId, Guid? invitingUserId,
|
|
|
|
|
|
IEnumerable<(OrganizationUserInvite invite, string externalId)> invites);
|
2022-11-09 12:13:29 +00:00
|
|
|
|
Task<List<OrganizationUser>> InviteUsersAsync(Guid organizationId, EventSystemUser systemUser,
|
|
|
|
|
|
IEnumerable<(OrganizationUserInvite invite, string externalId)> invites);
|
2021-01-30 17:56:37 -05:00
|
|
|
|
Task<OrganizationUser> InviteUserAsync(Guid organizationId, Guid? invitingUserId, string email,
|
2023-01-19 17:00:54 +01:00
|
|
|
|
OrganizationUserType type, bool accessAll, string externalId, IEnumerable<CollectionAccessSelection> collections, IEnumerable<Guid> groups);
|
2022-11-09 12:13:29 +00:00
|
|
|
|
Task<OrganizationUser> InviteUserAsync(Guid organizationId, EventSystemUser systemUser, string email,
|
2023-01-19 17:00:54 +01:00
|
|
|
|
OrganizationUserType type, bool accessAll, string externalId, IEnumerable<CollectionAccessSelection> collections, IEnumerable<Guid> groups);
|
2021-05-25 19:23:47 +02:00
|
|
|
|
Task<IEnumerable<Tuple<OrganizationUser, string>>> ResendInvitesAsync(Guid organizationId, Guid? invitingUserId, IEnumerable<Guid> organizationUsersId);
|
2023-04-14 11:13:16 +01:00
|
|
|
|
Task ResendInviteAsync(Guid organizationId, Guid? invitingUserId, Guid organizationUserId, bool initOrganization = false);
|
2020-02-19 14:56:16 -05:00
|
|
|
|
Task<OrganizationUser> ConfirmUserAsync(Guid organizationId, Guid organizationUserId, string key,
|
2020-03-09 15:13:40 -04:00
|
|
|
|
Guid confirmingUserId, IUserService userService);
|
2021-05-25 19:23:47 +02:00
|
|
|
|
Task<List<Tuple<OrganizationUser, string>>> ConfirmUsersAsync(Guid organizationId, Dictionary<Guid, string> keys,
|
|
|
|
|
|
Guid confirmingUserId, IUserService userService);
|
2023-01-19 17:00:54 +01:00
|
|
|
|
Task SaveUserAsync(OrganizationUser user, Guid? savingUserId, IEnumerable<CollectionAccessSelection> collections, IEnumerable<Guid> groups);
|
2022-10-31 09:58:21 +00:00
|
|
|
|
[Obsolete("IDeleteOrganizationUserCommand should be used instead. To be removed by EC-607.")]
|
2017-12-12 13:21:15 -05:00
|
|
|
|
Task DeleteUserAsync(Guid organizationId, Guid organizationUserId, Guid? deletingUserId);
|
2022-11-09 12:13:29 +00:00
|
|
|
|
[Obsolete("IDeleteOrganizationUserCommand should be used instead. To be removed by EC-607.")]
|
|
|
|
|
|
Task DeleteUserAsync(Guid organizationId, Guid organizationUserId, EventSystemUser systemUser);
|
2017-04-12 10:07:27 -04:00
|
|
|
|
Task DeleteUserAsync(Guid organizationId, Guid userId);
|
2021-05-25 19:23:47 +02:00
|
|
|
|
Task<List<Tuple<OrganizationUser, string>>> DeleteUsersAsync(Guid organizationId,
|
|
|
|
|
|
IEnumerable<Guid> organizationUserIds, Guid? deletingUserId);
|
2022-06-08 08:44:28 -05:00
|
|
|
|
Task UpdateUserResetPasswordEnrollmentAsync(Guid organizationId, Guid userId, string resetPasswordKey, Guid? callingUserId);
|
2020-04-23 11:29:19 -04:00
|
|
|
|
Task ImportAsync(Guid organizationId, Guid? importingUserId, IEnumerable<ImportedGroup> groups,
|
2019-05-06 21:31:20 -04:00
|
|
|
|
IEnumerable<ImportedOrganizationUser> newUsers, IEnumerable<string> removeUserExternalIds,
|
|
|
|
|
|
bool overwriteExisting);
|
2020-08-26 14:12:04 -04:00
|
|
|
|
Task DeleteSsoUserAsync(Guid userId, Guid? organizationId);
|
2021-07-01 14:31:05 +02:00
|
|
|
|
Task<Organization> UpdateOrganizationKeysAsync(Guid orgId, string publicKey, string privateKey);
|
2021-08-05 08:50:41 -04:00
|
|
|
|
Task<bool> HasConfirmedOwnersExceptAsync(Guid organizationId, IEnumerable<Guid> organizationUsersId, bool includeProvider = true);
|
2022-07-25 10:47:44 +10:00
|
|
|
|
Task RevokeUserAsync(OrganizationUser organizationUser, Guid? revokingUserId);
|
2022-11-09 12:13:29 +00:00
|
|
|
|
Task RevokeUserAsync(OrganizationUser organizationUser, EventSystemUser systemUser);
|
2022-07-25 10:47:44 +10:00
|
|
|
|
Task<List<Tuple<OrganizationUser, string>>> RevokeUsersAsync(Guid organizationId,
|
|
|
|
|
|
IEnumerable<Guid> organizationUserIds, Guid? revokingUserId);
|
2022-08-03 07:09:22 +10:00
|
|
|
|
Task RestoreUserAsync(OrganizationUser organizationUser, Guid? restoringUserId, IUserService userService);
|
2022-11-09 12:13:29 +00:00
|
|
|
|
Task RestoreUserAsync(OrganizationUser organizationUser, EventSystemUser systemUser, IUserService userService);
|
2022-07-25 10:47:44 +10:00
|
|
|
|
Task<List<Tuple<OrganizationUser, string>>> RestoreUsersAsync(Guid organizationId,
|
2022-08-03 07:09:22 +10:00
|
|
|
|
IEnumerable<Guid> organizationUserIds, Guid? restoringUserId, IUserService userService);
|
2023-04-14 11:13:16 +01:00
|
|
|
|
Task CreatePendingOrganization(Organization organization, string ownerEmail, ClaimsPrincipal user, IUserService userService, bool salesAssistedTrialStarted);
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Update an Organization entry by setting the public/private keys, set it as 'Enabled' and move the Status from 'Pending' to 'Created'.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// This method must target a disabled Organization that has null keys and status as 'Pending'.
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
Task InitPendingOrganization(Guid userId, Guid organizationId, string publicKey, string privateKey, string collectionName);
|
2023-02-24 07:54:19 +10:00
|
|
|
|
Task ReplaceAndUpdateCacheAsync(Organization org, EventType? orgEvent = null);
|
2023-07-24 23:05:05 +01:00
|
|
|
|
|
|
|
|
|
|
void ValidatePasswordManagerPlan(Models.StaticStore.Plan plan, OrganizationUpgrade upgrade);
|
|
|
|
|
|
void ValidateSecretsManagerPlan(Models.StaticStore.Plan plan, OrganizationUpgrade upgrade);
|
2023-09-01 09:10:02 +01:00
|
|
|
|
Task ValidateOrganizationUserUpdatePermissions(Guid organizationId, OrganizationUserType newType,
|
|
|
|
|
|
OrganizationUserType? oldType, Permissions permissions);
|
2017-03-03 00:07:11 -05:00
|
|
|
|
}
|