public async Task <IActionResult> ViewAuditLog(ViewAuditLogAddressModel model) { var user = await _grantChecker.EnsureGranted(model.AccessToken, model.OpenId, t => t.ViewAuditLog); var query = _dbContext .AuditLogs .Where(t => t.UserId == user.Id) .OrderByDescending(t => t.HappenTime); return(Json(await AiurPagedCollectionBuilder.BuildAsync <AuditLog>( query, model, ErrorType.Success, "Successfully get all your audit log!"))); }
public async Task <IActionResult> AllUserGranted(AllUserGrantedAddressModel model) { var appid = _tokenManager.ValidateAccessToken(model.AccessToken); var query = _dbContext .LocalAppGrant .Include(t => t.User) .Where(t => t.AppId == appid) .OrderByDescending(t => t.GrantTime); var result = await AiurPagedCollectionBuilder.BuildAsync <Grant>( query, model, ErrorType.Success, "Successfully get all your users"); return(Json(result)); }