mirror of
https://github.com/certd/certd.git
synced 2026-05-16 21:27:34 +08:00
feat: 权限控制
This commit is contained in:
@@ -13,6 +13,7 @@ import { HistoryService } from '../service/history-service';
|
||||
import { HistoryLogService } from '../service/history-log-service';
|
||||
import { HistoryEntity } from '../entity/history';
|
||||
import { HistoryLogEntity } from '../entity/history-log';
|
||||
import {Constants} from "../../../basic/constants";
|
||||
|
||||
/**
|
||||
* 证书
|
||||
@@ -29,13 +30,13 @@ export class HistoryController extends CrudController<HistoryService> {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
@Post('/page')
|
||||
@Post('/page', { summary: Constants.per.authOnly })
|
||||
async page(@Body(ALL) body) {
|
||||
body.query.userId = this.ctx.user.id;
|
||||
return super.page(body);
|
||||
}
|
||||
|
||||
@Post('/list')
|
||||
@Post('/list', { summary: Constants.per.authOnly })
|
||||
async list(@Body(ALL) body) {
|
||||
body.userId = this.ctx.user.id;
|
||||
if (body.pipelineId == null) {
|
||||
@@ -52,19 +53,19 @@ export class HistoryController extends CrudController<HistoryService> {
|
||||
return this.ok(listRet);
|
||||
}
|
||||
|
||||
@Post('/add')
|
||||
@Post('/add', { summary: Constants.per.authOnly })
|
||||
async add(@Body(ALL) bean: PipelineEntity) {
|
||||
bean.userId = this.ctx.user.id;
|
||||
return super.add(bean);
|
||||
}
|
||||
|
||||
@Post('/update')
|
||||
@Post('/update', { summary: Constants.per.authOnly })
|
||||
async update(@Body(ALL) bean) {
|
||||
await this.service.checkUserId(bean.id, this.ctx.user.id);
|
||||
return super.update(bean);
|
||||
}
|
||||
|
||||
@Post('/save')
|
||||
@Post('/save', { summary: Constants.per.authOnly })
|
||||
async save(@Body(ALL) bean: HistoryEntity) {
|
||||
bean.userId = this.ctx.user.id;
|
||||
if (bean.id > 0) {
|
||||
@@ -74,7 +75,7 @@ export class HistoryController extends CrudController<HistoryService> {
|
||||
return this.ok(bean.id);
|
||||
}
|
||||
|
||||
@Post('/saveLog')
|
||||
@Post('/saveLog', { summary: Constants.per.authOnly })
|
||||
async saveLog(@Body(ALL) bean: HistoryLogEntity) {
|
||||
bean.userId = this.ctx.user.id;
|
||||
if (bean.id > 0) {
|
||||
@@ -84,20 +85,20 @@ export class HistoryController extends CrudController<HistoryService> {
|
||||
return this.ok(bean.id);
|
||||
}
|
||||
|
||||
@Post('/delete')
|
||||
@Post('/delete', { summary: Constants.per.authOnly })
|
||||
async delete(@Query('id') id) {
|
||||
await this.service.checkUserId(id, this.ctx.user.id);
|
||||
return super.delete(id);
|
||||
}
|
||||
|
||||
@Post('/detail')
|
||||
@Post('/detail', { summary: Constants.per.authOnly })
|
||||
async detail(@Query('id') id) {
|
||||
await this.service.checkUserId(id, this.ctx.user.id);
|
||||
const detail = await this.service.detail(id);
|
||||
return this.ok(detail);
|
||||
}
|
||||
|
||||
@Post('/logs')
|
||||
@Post('/logs', { summary: Constants.per.authOnly })
|
||||
async logs(@Query('id') id) {
|
||||
await this.logService.checkUserId(id, this.ctx.user.id);
|
||||
const logInfo = await this.logService.info(id);
|
||||
|
||||
Reference in New Issue
Block a user