feat: 🎸 解决 修改用户角色,权限无法及时同步

This commit is contained in:
GoCo 2025-09-02 02:42:19 +08:00
parent c0a2047544
commit f020747b1f
3 changed files with 747 additions and 678 deletions

View File

@ -61,7 +61,7 @@ public class ShiroRealm extends AuthorizingRealm {
*/ */
@Override @Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
log.debug("===============Shiro权限认证开始============ [ roles、permissions]=========="); log.info("===============Shiro权限认证开始============ [ roles、permissions]==========");
String username = null; String username = null;
String userId = null; String userId = null;
if (principals != null) { if (principals != null) {
@ -73,13 +73,12 @@ public class ShiroRealm extends AuthorizingRealm {
// 设置用户拥有的角色集合比如admin,test // 设置用户拥有的角色集合比如admin,test
Set<String> roleSet = commonApi.queryUserRolesById(userId); Set<String> roleSet = commonApi.queryUserRolesById(userId);
//System.out.println(roleSet.toString()); // System.out.println(roleSet.toString());
info.setRoles(roleSet); info.setRoles(roleSet);
// 设置用户拥有的权限集合比如sys:role:add,sys:user:add // 设置用户拥有的权限集合比如sys:role:add,sys:user:add
Set<String> permissionSet = commonApi.queryUserAuths(userId); Set<String> permissionSet = commonApi.queryUserAuths(userId);
info.addStringPermissions(permissionSet); info.addStringPermissions(permissionSet);
//System.out.println(permissionSet);
log.info("===============Shiro权限认证成功=============="); log.info("===============Shiro权限认证成功==============");
return info; return info;
} }

View File

@ -1,17 +1,5 @@
${AnsiColor.BRIGHT_BLUE} ${AnsiColor.BRIGHT_BLUE}
(_) | | | |
_ ___ ___ ___ __ _ ______| |__ ___ ___ | |_
| |/ _ \/ _ \/ __/ _` |______| '_ \ / _ \ / _ \| __|
| | __/ __/ (_| (_| | | |_) | (_) | (_) | |_
| |\___|\___|\___\__, | |_.__/ \___/ \___/ \__|
_/ | __/ |
|__/ |___/
${AnsiColor.BRIGHT_GREEN} ${AnsiColor.BRIGHT_GREEN}
Jeecg Boot Version: 3.8.2 Jeecg Boot Version: 3.8.2
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version} Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
产品官网: www.jeecg.com
版权所属: 北京国炬信息技术有限公司
公司官网: www.guojusoft.com
${AnsiColor.BLACK} ${AnsiColor.BLACK}