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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user