🐛 修复小程序令牌严格校验 401,并开放调度端打卡接口
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+12
-2
@@ -35,6 +35,14 @@ import org.springblade.system.pojo.enums.MpUserIdentity;
|
||||
*/
|
||||
public final class MpUserAuth {
|
||||
|
||||
/**
|
||||
* 严格令牌模式下的占位 ID。
|
||||
* <p>
|
||||
* {@code blade.secure.strict-token=true} 时,AuthUtil.userIncomplete 要求 roleId/deptId
|
||||
* 非空且数值 >= 0;小程序用户不绑定系统角色/部门,用 0 占位避免业务接口 401。
|
||||
*/
|
||||
public static final String PLACEHOLDER_ID = "0";
|
||||
|
||||
private MpUserAuth() {
|
||||
}
|
||||
|
||||
@@ -56,8 +64,10 @@ public final class MpUserAuth {
|
||||
if (detail != null && MpUserIdentity.DETAIL_TYPE.equalsIgnoreCase(Func.toStr(detail.get("type")))) {
|
||||
return true;
|
||||
}
|
||||
// 兼容:无系统角色且 roleName 为小程序身份
|
||||
return Func.isBlank(bladeUser.getRoleId())
|
||||
// 兼容:无真实系统角色(空或占位 0)且 roleName 为小程序身份
|
||||
String roleId = Func.toStr(bladeUser.getRoleId());
|
||||
boolean noSystemRole = Func.isBlank(roleId) || PLACEHOLDER_ID.equals(roleId);
|
||||
return noSystemRole
|
||||
&& Func.isNotBlank(bladeUser.getRoleName())
|
||||
&& !MpUserIdentity.split(bladeUser.getRoleName()).isEmpty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user