fix: 收口模板契约与安全门禁
统一模板包 visual 契约并补齐完成证据;修复 release 版本一致性、管理员 token 撤销、CORS 与默认品牌配置;收敛依赖安全风险并完成全量回归验证。
This commit is contained in:
1 parent
456171aa85
commit
4f0b50c7f1
84 files changed
+7367
-5180
No files matched your search
@@ -21,9 +21,11 @@ export class AdminAccessService {
|
||||
if (identity.role !== "admin") throw new ForbiddenException("无管理员权限");
|
||||
const user = await this.prisma.adminUser.findUnique({
|
||||
where: { id: identity.subject },
|
||||
select: { mustChangePassword: true, isEnabled: true },
|
||||
select: { mustChangePassword: true, isEnabled: true, tokenVersion: true },
|
||||
});
|
||||
if (!user?.isEnabled || user.mustChangePassword)
|
||||
if (!user || identity.tokenVersion !== user.tokenVersion)
|
||||
throw new UnauthorizedException("管理员登录态已失效,请重新登录");
|
||||
if (!user.isEnabled || user.mustChangePassword)
|
||||
throw new ForbiddenException("请先完成初始密码修改后再访问管理后台");
|
||||
const membership = await this.prisma.brandMembership.findUnique({
|
||||
where: { adminUserId_brandId: { adminUserId: identity.subject, brandId: identity.brandId } },
|
||||
@@ -52,9 +54,16 @@ export class AdminAccessService {
|
||||
if (identity.role !== "admin") throw new ForbiddenException("无管理员权限");
|
||||
const user = await this.prisma.adminUser.findUnique({
|
||||
where: { id: identity.subject },
|
||||
select: { isEnabled: true, mustChangePassword: true, platformTemplateRole: true },
|
||||
select: {
|
||||
isEnabled: true,
|
||||
mustChangePassword: true,
|
||||
platformTemplateRole: true,
|
||||
tokenVersion: true,
|
||||
},
|
||||
});
|
||||
if (!user?.isEnabled || user.mustChangePassword)
|
||||
if (!user || identity.tokenVersion !== user.tokenVersion)
|
||||
throw new UnauthorizedException("管理员登录态已失效,请重新登录");
|
||||
if (!user.isEnabled || user.mustChangePassword)
|
||||
throw new ForbiddenException("请先完成初始密码修改后再访问管理后台");
|
||||
if (user.platformTemplateRole !== "template_admin")
|
||||
throw new ForbiddenException("当前账号没有模板管理权限");
|
||||
|
||||
Reference in new issue
Block a user