mirror of
https://github.com/certd/certd.git
synced 2026-04-14 20:40:53 +08:00
chore: 支持仅查询其他用户的流水线
This commit is contained in:
@@ -33,7 +33,20 @@ export class PipelineController extends CrudController<PipelineService> {
|
||||
async page(@Body(ALL) body) {
|
||||
const isAdmin = await this.authService.isAdmin(this.ctx);
|
||||
const publicSettings = await this.sysSettingsService.getPublicSettings();
|
||||
if (!(publicSettings.managerOtherUserPipeline && isAdmin)) {
|
||||
|
||||
let onlyOther = false
|
||||
if(isAdmin){
|
||||
if(publicSettings.managerOtherUserPipeline){
|
||||
//管理员管理 其他用户
|
||||
if( body.query.userId === -1){
|
||||
//如果只查询其他用户
|
||||
onlyOther = true;
|
||||
delete body.query.userId;
|
||||
}
|
||||
}else{
|
||||
body.query.userId = this.getUserId();
|
||||
}
|
||||
}else{
|
||||
body.query.userId = this.getUserId();
|
||||
}
|
||||
|
||||
@@ -44,6 +57,9 @@ export class PipelineController extends CrudController<PipelineService> {
|
||||
if (title) {
|
||||
qb.andWhere('(title like :title or content like :content)', { title: `%${title}%`, content: `%${title}%` });
|
||||
}
|
||||
if(onlyOther){
|
||||
qb.andWhere('user_id != :userId', { userId: this.getUserId() });
|
||||
}
|
||||
};
|
||||
if (!body.sort || !body.sort?.prop) {
|
||||
body.sort = { prop: 'order', asc: false };
|
||||
|
||||
Reference in New Issue
Block a user