init local code

This commit is contained in:
chenxing
2026-09-07 09:09:39 +08:00
commit 99cd26b3d2
259 changed files with 20554 additions and 0 deletions
@@ -0,0 +1,30 @@
package com.yunhai.cms.config;
import com.yunhai.platform.utils.model.BoaUser;
import org.springframework.stereotype.Component;
/**
* CMS 权限判定(对齐 UserBase GroupAuthzService#isSuperAdmin 与 UserTypeEnum 平台约定)。
*
* <p>超管规则:{@code BoaUser.type == 1}(UserTypeEnum.SUPER_ADMIN,系统种子账号),
* 或 {@code BoaUser.id == 100000}(基石超级管理员账号,同 UserBase 内部判定)。
* type 随认证链路经 BoaUserLoader 从 UserBase 换出,无需任何注入配置。
* 学校管理员(type=2,持 ADMIN 角色)与学校领导不特判,统一走
* {@code currentRole.schId → site.schId} 校级规则(方案 §7.2 规则②)。</p>
*/
@Component
public class CmsAuthProperties {
/** UserBase 基石超级管理员账号 id(DicUtil.SUPER_ADMIN_ID,平台约定常量) */
private static final int PLATFORM_ROOT_USER_ID = 100000;
public boolean isSuperAdmin(BoaUser user) {
if (user == null) {
return false;
}
if (user.getType() != null && user.getType() == 1) {
return true;
}
return user.getId() != null && user.getId() == PLATFORM_ROOT_USER_ID;
}
}