|
@@ -1,6 +1,8 @@
|
|
|
package cn.hfln.framework.gateway.config;
|
|
|
|
|
|
+import cn.dev33.satoken.session.SaSession;
|
|
|
import cn.dev33.satoken.stp.StpInterface;
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hfln.framework.redis.util.RedisUtil;
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -51,13 +53,15 @@ public class StpInterfaceImpl implements StpInterface {
|
|
|
public List<String> getRoleList(Object loginIdObj, String loginType) {
|
|
|
|
|
|
// 当前登录用户的角色
|
|
|
- String roleKeyPre = "hfln:role:";
|
|
|
- String roleListStr = (String)redisService.get(roleKeyPre + loginIdObj);
|
|
|
- if (!StringUtils.hasText(roleListStr)) {
|
|
|
- log.info("当前账户未配置角色, loginId :{}", loginIdObj);
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
- return new ArrayList<>(JSONArray.parseArray(roleListStr, String.class));
|
|
|
+// String roleKeyPre = "hfln:role:";
|
|
|
+// String roleListStr = (String)redisService.get(roleKeyPre + loginIdObj);
|
|
|
+// if (!StringUtils.hasText(roleListStr)) {
|
|
|
+// log.info("当前账户未配置角色, loginId :{}", loginIdObj);
|
|
|
+// return new ArrayList<>();
|
|
|
+// }
|
|
|
+ List<String> roleCodeList = StpUtil.getSession().getModel(SaSession.ROLE_LIST, List.class);
|
|
|
+ return roleCodeList == null ? new ArrayList<>() : roleCodeList;
|
|
|
+// return new ArrayList<>(JSONArray.parseArray(roleListStr, String.class));
|
|
|
}
|
|
|
|
|
|
}
|