mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
chore: swagger support
This commit is contained in:
@@ -116,7 +116,7 @@ export abstract class BaseController {
|
||||
await authService.checkProjectId(service, id, projectId);
|
||||
}else{
|
||||
|
||||
if(userId === 0){
|
||||
if(userId === Constants.systemUserId){
|
||||
//系统级别,不检查权限
|
||||
}else{
|
||||
if(allowAdmin){
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Inject } from '@midwayjs/core';
|
||||
import { TypeORMDataSourceManager } from '@midwayjs/typeorm';
|
||||
import { EntityManager } from 'typeorm/entity-manager/EntityManager.js';
|
||||
import { FindManyOptions } from 'typeorm';
|
||||
import { Constants } from './constants.js';
|
||||
|
||||
export type PageReq<T = any> = {
|
||||
page?: { offset: number; limit: number };
|
||||
@@ -258,7 +259,7 @@ export abstract class BaseService<T> {
|
||||
|
||||
export function checkUserProjectParam(userId: number, projectId: number) {
|
||||
if (projectId != null ){
|
||||
if( userId !==-1) {
|
||||
if( userId !== Constants.enterpriseUserId) {
|
||||
throw new ValidateException('userId projectId 错误');
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -120,4 +120,6 @@ export const Constants = {
|
||||
message: '用户邮箱还未配置',
|
||||
},
|
||||
},
|
||||
systemUserId: 0, // 系统级别userid固定为0
|
||||
enterpriseUserId: -1 // 企业模式用户id固定为-1
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user