1
0
mirror of https://github.com/bitwarden/server synced 2025-12-26 05:03:18 +00:00

Added some more comments for clarity and small touchups.

This commit is contained in:
Patrick Pimentel
2025-12-03 22:49:27 -05:00
parent 5629d6fe05
commit c09a9734a7
2 changed files with 13 additions and 1 deletions

View File

@@ -59,10 +59,21 @@ public interface IUserService
Task<bool> CheckPasswordAsync(User user, string password);
/// <summary>
/// Checks if the user has access to premium features, either through a personal subscription or through an organization.
///
/// This is the preferred way to definitively know if a user has access to premium features.
/// </summary>
/// <param name="user">user being acted on</param>
/// <returns>true if they can access premium; false otherwise.</returns>
Task<bool> CanAccessPremium(User user);
/// <summary>
/// Checks if the user has inherited access to premium features through an organization.
///
/// This primarily serves as a means to communicate to the client when a user has inherited their premium status
/// through an organization. Feature gating logic probably should not be behind this check.
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
Task<bool> HasPremiumFromOrganization(User user);
Task<string> GenerateSignInTokenAsync(User user, string purpose);

View File

@@ -1112,7 +1112,7 @@ public class UserService : UserManager<User>, IUserService
return false;
}
return user.Premium || await this.HasPremiumFromOrganization(user);
return user.Premium || await HasPremiumFromOrganization(user);
}
public async Task<bool> HasPremiumFromOrganization(User user)
@@ -1138,6 +1138,7 @@ public class UserService : UserManager<User>, IUserService
orgAbility.UsersGetPremium &&
orgAbility.Enabled);
}
public async Task<string> GenerateSignInTokenAsync(User user, string purpose)
{
var token = await GenerateUserTokenAsync(user, Options.Tokens.PasswordResetTokenProvider,