liuyun 513688a5e6 fix(security): P0 安全越权堵漏(C1/H1-H6/H10/H11/H13/M1/M4/M6/M8-M11/M22)
- 平台管理员模型:super_admin=平台超管、tenant_super_admin=租户顶层(保留码),tenant:* 仅平台可授予
- 软删改名回收唯一键 + P2002→409
- 删除角色级联清理关联 + 聚合过滤已删/停用角色资源
- tokenVersion 会话吊销(重置密码/停用/删除即时踢下线)
- data_scope self 按 userId 过滤 + 详情数据权限校验
- 组织树防环、seed 不重置密码、日志脱敏补 phone/email
- JWT 密钥强校验、pageSize 上限、DTO 枚举校验、Prisma 错误映射、授权事务化

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-11 16:10:00 +08:00

58 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsIn, IsInt, IsNotEmpty, IsOptional, IsString } from 'class-validator';
import { CommonStatus } from '../common/enums.js';
export class CreateOrgDto {
@ApiProperty({ description: '组织 code(租户内唯一)' })
@IsString()
@IsNotEmpty()
code!: string;
@ApiProperty({ description: '组织名称' })
@IsString()
@IsNotEmpty()
name!: string;
@ApiPropertyOptional({ description: '父组织 code' })
@IsOptional()
@IsString()
parentCode?: string;
@ApiPropertyOptional({ description: '负责人' })
@IsOptional()
@IsString()
leader?: string;
@ApiPropertyOptional({ description: '排序', default: 0 })
@IsOptional()
@IsInt()
sort?: number;
}
export class UpdateOrgDto {
@ApiPropertyOptional({ description: '组织名称' })
@IsOptional()
@IsString()
name?: string;
@ApiPropertyOptional({ description: '父组织 code' })
@IsOptional()
@IsString()
parentCode?: string;
@ApiPropertyOptional({ description: '负责人' })
@IsOptional()
@IsString()
leader?: string;
@ApiPropertyOptional({ description: '排序' })
@IsOptional()
@IsInt()
sort?: number;
@ApiPropertyOptional({ description: '状态:enabled/disabled' })
@IsOptional()
@IsIn(Object.values(CommonStatus))
status?: string;
}