forked from TencentBlueKing/bk-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:auth模块操作记录,并在op系统展示 TencentBlueKing#973
- Loading branch information
1 parent
d030ef7
commit 514caab
Showing
7 changed files
with
320 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...z-opdata/src/main/kotlin/com/tencent/bkrepo/opdata/controller/AuthOperateLogController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. | ||
* | ||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. | ||
* | ||
* A copy of the MIT License is included in this file. | ||
* | ||
* | ||
* Terms of the MIT License: | ||
* --------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bkrepo.opdata.controller | ||
|
||
import com.tencent.bkrepo.common.api.pojo.Page | ||
import com.tencent.bkrepo.common.api.pojo.Response | ||
import com.tencent.bkrepo.common.operate.api.OperateLogService | ||
import com.tencent.bkrepo.common.operate.api.pojo.OperateLogResponse | ||
import com.tencent.bkrepo.common.service.util.ResponseBuilder | ||
import io.swagger.annotations.Api | ||
import io.swagger.annotations.ApiOperation | ||
import io.swagger.annotations.ApiParam | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RequestParam | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@Api("auth模块日志接口") | ||
@RestController | ||
@RequestMapping("/api/log") | ||
class AuthOperateLogController( | ||
private val operateLogService: OperateLogService | ||
) { | ||
|
||
@ApiOperation("auth日志查询接口") | ||
@GetMapping("/page") | ||
fun page( | ||
@ApiParam("项目名", required = false) | ||
@RequestParam projectId: String?, | ||
@ApiParam("仓库名", required = false) | ||
@RequestParam repoName: String?, | ||
@ApiParam("操作人", required = false) | ||
@RequestParam operator: String?, | ||
@ApiParam("开始时间", required = false) | ||
@RequestParam startTime: String?, | ||
@ApiParam("结束时间", required = false) | ||
@RequestParam endTime: String?, | ||
@ApiParam("页数", required = false, defaultValue = "1") | ||
@RequestParam pageNumber: Int?, | ||
@ApiParam("每页数量", required = false, defaultValue = "20") | ||
@RequestParam pageSize: Int? | ||
): Response<Page<OperateLogResponse?>> { | ||
val page = operateLogService.page( | ||
"AUTH_LOG", projectId, null, | ||
operator, startTime, endTime, pageNumber ?: 1, pageSize ?: 20 | ||
) | ||
return ResponseBuilder.success(page) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import request from '@/utils/request' | ||
|
||
const PREFIX_SERVICES = '/opdata/api' | ||
export const DEFAULT_PAGE_SIZE = 10 | ||
|
||
export function page(num, size, projectId, startTime, endTime, userId) { | ||
return request({ | ||
url: `${PREFIX_SERVICES}/log/page`, | ||
method: 'get', | ||
params: { | ||
projectId: projectId, | ||
startTime: startTime, | ||
endTime: endTime, | ||
operator: userId, | ||
pageNumber: num, | ||
pageSize: size | ||
} | ||
}) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.