Identity Server Api Resource repository

pull/538/head
Yunus Emre Kalkan 7 years ago
parent 5aab9c2df5
commit ba600d75c6

@ -72,5 +72,10 @@ namespace Volo.Abp.IdentityServer.ApiResources
{
UserClaims.Add(new ApiResourceClaim(Id, type));
}
public virtual void RemoveAllUserClaims()
{
UserClaims.Clear();
}
}
}

@ -21,8 +21,18 @@ namespace Volo.Abp.IdentityServer.ApiResources
);
Task<List<ApiResource>> GetListAsync(
string sorting,
int skipCount,
int maxResultCount,
bool includeDetails = false,
CancellationToken cancellationToken = default
);
Task<List<ApiResource>> GetListAsync(
bool includeDetails = false,
CancellationToken cancellationToken = default
);
Task<long> GetTotalCount();
}
}

@ -27,6 +27,6 @@ namespace Volo.Abp.IdentityServer.IdentityResources
CancellationToken cancellationToken = default
);
Task<long> GetTotalBlogCount();
Task<long> GetTotalCount();
}
}

@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
using System.Linq.Dynamic.Core;
namespace Volo.Abp.IdentityServer.ApiResources
{
@ -42,6 +43,15 @@ namespace Volo.Abp.IdentityServer.ApiResources
return await query.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<List<ApiResource>> GetListAsync(string sorting, int skipCount, int maxResultCount, bool includeDetails = false,
CancellationToken cancellationToken = default)
{
return await DbSet
.IncludeDetails(includeDetails).OrderBy(sorting ?? "name desc")
.PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<List<ApiResource>> GetListAsync(
bool includeDetails = false,
CancellationToken cancellationToken = default)
@ -51,6 +61,11 @@ namespace Volo.Abp.IdentityServer.ApiResources
.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<long> GetTotalCount()
{
return await DbSet.CountAsync();
}
public override IQueryable<ApiResource> WithDetails()
{
return GetQueryable().IncludeDetails();

@ -54,7 +54,7 @@ namespace Volo.Abp.IdentityServer.IdentityResources
.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<long> GetTotalBlogCount()
public virtual async Task<long> GetTotalCount()
{
return await DbSet.CountAsync();
}

@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
using Volo.Abp.Domain.Repositories.MongoDB;
using Volo.Abp.IdentityServer.ApiResources;
using System.Linq.Dynamic.Core;
using Volo.Abp.MongoDB;
namespace Volo.Abp.IdentityServer.MongoDB
@ -32,5 +32,20 @@ namespace Volo.Abp.IdentityServer.MongoDB
.Where(ar=>ar.Scopes.Any(x=> scopeNames.Contains(x.Name)))
.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<List<ApiResource>> GetListAsync(string sorting, int skipCount, int maxResultCount, bool includeDetails = false,
CancellationToken cancellationToken = default)
{
return await GetMongoQueryable()
.OrderBy(sorting ?? nameof(ApiResource.Name))
.As<IMongoQueryable<ApiResource>>()
.PageBy<ApiResource, IMongoQueryable<ApiResource>>(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<long> GetTotalCount()
{
return await GetCountAsync();
}
}
}

@ -36,7 +36,7 @@ namespace Volo.Abp.IdentityServer.MongoDB
.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<long> GetTotalBlogCount()
public virtual async Task<long> GetTotalCount()
{
return await GetCountAsync();
}

Loading…
Cancel
Save