| | | 1 | | using Elsa.Identity.Contracts; |
| | | 2 | | using Elsa.Identity.Entities; |
| | | 3 | | using Elsa.Identity.Models; |
| | | 4 | | |
| | | 5 | | // ReSharper disable once CheckNamespace |
| | | 6 | | namespace Elsa.Extensions; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Provides extensions for <see cref="IRoleProvider"/>. |
| | | 10 | | /// </summary> |
| | | 11 | | public static class RoleProviderExtensions |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Finds the roles with the specified IDs. |
| | | 15 | | /// </summary> |
| | | 16 | | /// <param name="roleProvider">The role provider.</param> |
| | | 17 | | /// <param name="ids">The IDs to filter for.</param> |
| | | 18 | | /// <param name="cancellationToken">The cancellation token.</param> |
| | | 19 | | /// <returns>The roles with the specified IDs.</returns> |
| | | 20 | | public static async Task<IEnumerable<Role>> FindByIdsAsync(this IRoleProvider roleProvider, IEnumerable<string> ids, |
| | | 21 | | { |
| | 0 | 22 | | var filter = new RoleFilter() |
| | 0 | 23 | | { |
| | 0 | 24 | | Ids = ids.Distinct().ToList() |
| | 0 | 25 | | }; |
| | | 26 | | |
| | 0 | 27 | | return await roleProvider.FindManyAsync(filter, cancellationToken); |
| | 0 | 28 | | } |
| | | 29 | | } |