Skip to content

Commit

Permalink
chore: add .Return() remark
Browse files Browse the repository at this point in the history
  • Loading branch information
mvarendorff2 authored and Enterprize1 committed Nov 6, 2024
1 parent 4c6d45a commit e00f0b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Fluss/Authentication/ArbitraryUserUnitOfWorkExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ public static UnitOfWorkFactory GetUserUnitOfWorkFactory(this IServiceProvider s
return serviceProvider.GetRequiredService<IArbitraryUserUnitOfWorkCache>().GetUserUnitOfWorkFactory(userId);
}

/// <summary>
/// Returns a UnitOfWork that is configured to use the provided Guid for determining the current user.
///
/// <b>You MUST call .Return() on the result of this function once it's not required any more.</b>
/// </summary>
/// <param name="serviceProvider">this</param>
/// <param name="userId">The id of the user that the UnitOfWork should use for authorization.</param>
/// <returns>A UnitOfWork that is configured to use the provided Guid for determining the current user.</returns>
public static IUnitOfWork GetUserUnitOfWork(this IServiceProvider serviceProvider, Guid userId)
{
return serviceProvider.GetRequiredService<IArbitraryUserUnitOfWorkCache>().GetUserUnitOfWork(userId);
Expand Down
7 changes: 7 additions & 0 deletions src/Fluss/Authentication/SystemUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ public static UnitOfWorkFactory GetSystemUserUnitOfWorkFactory(this IServiceProv
return serviceProvider.GetUserUnitOfWorkFactory(SystemUserGuid);
}

/// <summary>
/// Returns a UnitOfWork that is configured to use the system user for authorization.
///
/// <b>You MUST call .Return() on the result of this function once it's not required any more.</b>
/// </summary>
/// <param name="serviceProvider">this</param>
/// <returns>A UnitOfWork that is configured to use the system user for authorization.</returns>
public static IUnitOfWork GetSystemUserUnitOfWork(this IServiceProvider serviceProvider)
{
return serviceProvider.GetUserUnitOfWork(SystemUserGuid);
Expand Down

0 comments on commit e00f0b7

Please sign in to comment.