fix: 修复流水线分组可以被所有人看见的bug

pull/265/head
xiaojunnuo 2024-12-09 02:24:30 +08:00
parent 30ddf5ec41
commit a0e838d1ee
8 changed files with 17 additions and 12 deletions

View File

@ -20,7 +20,8 @@ export class CnameProviderController extends BaseController {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
const res = await this.providerService.list({});
return this.ok(res);
}

View File

@ -39,7 +39,8 @@ export class CnameRecordController extends CrudController<CnameRecordService> {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
const list = await this.getService().list(body);
return this.ok(list);
}

View File

@ -25,7 +25,8 @@ export class UserSettingsController extends CrudController<UserSettingsService>
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}

View File

@ -37,7 +37,8 @@ export class AccessController extends CrudController<AccessService> {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}

View File

@ -78,9 +78,10 @@ export class HistoryController extends CrudController<HistoryService> {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.query = body.query ?? {};
const isAdmin = await this.authService.isAdmin(this.ctx);
if (!isAdmin) {
body.userId = this.getUserId();
body.query.userId = this.getUserId();
}
if (body.pipelineId == null) {
return this.ok([]);

View File

@ -38,7 +38,8 @@ export class NotificationController extends CrudController<NotificationService>
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}

View File

@ -36,7 +36,8 @@ export class PipelineGroupController extends CrudController<PipelineGroupService
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return await super.list(body);
}
@ -67,7 +68,9 @@ export class PipelineGroupController extends CrudController<PipelineGroupService
@Post('/all', { summary: Constants.per.authOnly })
async all() {
const list: any = await this.service.find({
userId: this.getUserId(),
where: {
userId: this.getUserId(),
},
});
return this.ok(list);
}

View File

@ -29,20 +29,16 @@ export class SysSettingsController extends CrudController<SysSettingsService> {
@Post('/page', { summary: 'sys:settings:view' })
async page(@Body(ALL) body) {
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.page(body);
}
@Post('/list', { summary: 'sys:settings:view' })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
return super.list(body);
}
@Post('/add', { summary: 'sys:settings:edit' })
async add(@Body(ALL) bean) {
bean.userId = this.getUserId();
return super.add(bean);
}