Beispiel #1
0
        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 AiurPagedCollection <AuditLog> .BuildAsync(
                            query,
                            model,
                            ErrorType.Success,
                            "Successfully get all your audit log!")));
        }
Beispiel #2
0
        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 AiurPagedCollection <Grant> .BuildAsync(
                query,
                model,
                ErrorType.Success,
                "Successfully get all your users");

            return(Json(result));
        }