|
|
|
|
@ -8,6 +8,7 @@ using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
|
|
|
|
|
using Volo.Abp.EntityFrameworkCore;
|
|
|
|
|
using Volo.Abp.IdentityServer.EntityFrameworkCore;
|
|
|
|
|
using System.Linq.Dynamic.Core;
|
|
|
|
|
using System.Runtime.InteropServices.ComTypes;
|
|
|
|
|
|
|
|
|
|
namespace Volo.Abp.IdentityServer.ApiResources
|
|
|
|
|
{
|
|
|
|
|
@ -24,30 +25,35 @@ namespace Volo.Abp.IdentityServer.ApiResources
|
|
|
|
|
CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
|
var query = from apiResource in DbSet.IncludeDetails(includeDetails)
|
|
|
|
|
where apiResource.Name == name
|
|
|
|
|
select apiResource;
|
|
|
|
|
where apiResource.Name == name
|
|
|
|
|
select apiResource;
|
|
|
|
|
|
|
|
|
|
return await query
|
|
|
|
|
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual async Task<List<ApiResource>> GetListByScopesAsync(
|
|
|
|
|
string[] scopeNames,
|
|
|
|
|
string[] scopeNames,
|
|
|
|
|
bool includeDetails = false,
|
|
|
|
|
CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
|
var query = from api in DbSet.IncludeDetails(includeDetails)
|
|
|
|
|
where api.Scopes.Any(x => scopeNames.Contains(x.Name))
|
|
|
|
|
select api;
|
|
|
|
|
where api.Scopes.Any(x => scopeNames.Contains(x.Name))
|
|
|
|
|
select api;
|
|
|
|
|
|
|
|
|
|
return await query.ToListAsync(GetCancellationToken(cancellationToken));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual async Task<List<ApiResource>> GetListAsync(string sorting, int skipCount, int maxResultCount, bool includeDetails = false,
|
|
|
|
|
public virtual async Task<List<ApiResource>> GetListAsync(
|
|
|
|
|
string sorting, int skipCount, int maxResultCount, string filter, bool includeDetails = false,
|
|
|
|
|
CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
|
return await DbSet
|
|
|
|
|
.IncludeDetails(includeDetails).OrderBy(sorting ?? "name desc")
|
|
|
|
|
.IncludeDetails(includeDetails)
|
|
|
|
|
.WhereIf(filter != null, x => x.Name.Contains(filter) ||
|
|
|
|
|
x.Description.Contains(filter) ||
|
|
|
|
|
x.DisplayName.Contains(filter))
|
|
|
|
|
.OrderBy(sorting ?? "name desc")
|
|
|
|
|
.PageBy(skipCount, maxResultCount)
|
|
|
|
|
.ToListAsync(GetCancellationToken(cancellationToken));
|
|
|
|
|
}
|
|
|
|
|
|