mirror of
https://github.com/bitwarden/server
synced 2025-12-26 05:03:18 +00:00
* fix : split out the interface from the TwoFactorAuthenticationValidator into separate file. * fix: replacing IUserService.TwoFactorEnabled with ITwoFactorEnabledQuery * fix: combined logic for both bulk and single user look ups for TwoFactorIsEnabledQuery. * fix: return two factor provider enabled on CanGenerate() method. * tech debt: modfifying MFA providers to call the database less to validate if two factor is enabled. * tech debt: removed unused service from AuthenticatorTokenProvider * doc: added documentation to ITwoFactorProviderUsers * doc: updated comments for TwoFactorIsEnabled impl * test: fixing tests for ITwoFactorIsEnabledQuery * test: updating tests to have correct DI and removing test for automatic email of TOTP. * test: adding better test coverage
49 lines
2.4 KiB
C#
49 lines
2.4 KiB
C#
using Bit.Core.Entities;
|
|
using Bit.Core.KeyManagement.UserKey;
|
|
using Bit.Core.Models.Data;
|
|
|
|
#nullable enable
|
|
|
|
namespace Bit.Core.Repositories;
|
|
|
|
public interface IUserRepository : IRepository<User, Guid>
|
|
{
|
|
Task<User?> GetByEmailAsync(string email);
|
|
Task<IEnumerable<User>> GetManyByEmailsAsync(IEnumerable<string> emails);
|
|
Task<User?> GetBySsoUserAsync(string externalId, Guid? organizationId);
|
|
Task<UserKdfInformation?> GetKdfInformationByEmailAsync(string email);
|
|
Task<ICollection<User>> SearchAsync(string email, int skip, int take);
|
|
Task<ICollection<User>> GetManyByPremiumAsync(bool premium);
|
|
Task<string?> GetPublicKeyAsync(Guid id);
|
|
Task<DateTime> GetAccountRevisionDateAsync(Guid id);
|
|
Task UpdateStorageAsync(Guid id);
|
|
Task UpdateRenewalReminderDateAsync(Guid id, DateTime renewalReminderDate);
|
|
Task<IEnumerable<User>> GetManyAsync(IEnumerable<Guid> ids);
|
|
/// <summary>
|
|
/// Retrieves the data for the requested user IDs and includes an additional property indicating
|
|
/// whether the user has premium access directly or through an organization.
|
|
/// </summary>
|
|
Task<IEnumerable<UserWithCalculatedPremium>> GetManyWithCalculatedPremiumAsync(IEnumerable<Guid> ids);
|
|
/// <summary>
|
|
/// Retrieves the data for the requested user ID and includes additional property indicating
|
|
/// whether the user has premium access directly or through an organization.
|
|
///
|
|
/// Calls the same stored procedure as GetManyWithCalculatedPremiumAsync but handles the query
|
|
/// for a single user.
|
|
/// </summary>
|
|
/// <param name="userId">The user ID to retrieve data for.</param>
|
|
/// <returns>User data with calculated premium access; null if nothing is found</returns>
|
|
Task<UserWithCalculatedPremium?> GetCalculatedPremiumAsync(Guid userId);
|
|
/// <summary>
|
|
/// Sets a new user key and updates all encrypted data.
|
|
/// <para>Warning: Any user key encrypted data not included will be lost.</para>
|
|
/// </summary>
|
|
/// <param name="user">The user to update</param>
|
|
/// <param name="updateDataActions">Registered database calls to update re-encrypted data.</param>
|
|
Task UpdateUserKeyAndEncryptedDataAsync(User user,
|
|
IEnumerable<UpdateEncryptedDataForKeyRotation> updateDataActions);
|
|
Task UpdateUserKeyAndEncryptedDataV2Async(User user,
|
|
IEnumerable<UpdateEncryptedDataForKeyRotation> updateDataActions);
|
|
Task DeleteManyAsync(IEnumerable<User> users);
|
|
}
|