|
|
@@ -74,18 +74,23 @@ public class ShiroRealm extends AuthorizingRealm {
|
|
|
}
|
|
|
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
|
|
|
|
|
|
- // 设置用户拥有的角色集合,比如"admin,test"
|
|
|
- Set<String> roleSet = commonApi.queryUserRolesById(userId);
|
|
|
+ // 小程序/SSO用户(username以personal_或enterprise_开头)无需RBAC权限校验,授予通配权限
|
|
|
+ // 这类用户不是后台管理系统用户,只要能看到的页面,其背后接口都应允许调用
|
|
|
+ if (username != null && (username.startsWith("personal_") || username.startsWith("enterprise_"))) {
|
|
|
+ info.addStringPermission("*");
|
|
|
+ log.debug("===============小程序/SSO用户[{}]授予通配权限==============", username);
|
|
|
+ return info;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置用户拥有的角色集合,比如"admin,test"
|
|
|
+ Set<String> roleSet = commonApi.queryUserRolesById(userId);
|
|
|
//System.out.println(roleSet.toString());
|
|
|
info.setRoles(roleSet);
|
|
|
|
|
|
- // 设置用户拥有的权限集合,比如"sys:role:add,sys:user:add"
|
|
|
+ // 设置用户拥有的权限集合,比如“sys:role:add,sys:user:add”
|
|
|
Set<String> permissionSet = commonApi.queryUserAuths(userId);
|
|
|
info.addStringPermissions(permissionSet);
|
|
|
- // 小程序用户(enterprise_/personal_开头)授予全部权限
|
|
|
- if (username != null && (username.startsWith("enterprise_") || username.startsWith("personal_"))) {
|
|
|
- info.addStringPermission("*");
|
|
|
- }
|
|
|
+ //System.out.println(permissionSet);
|
|
|
log.debug("===============Shiro权限认证成功==============");
|
|
|
return info;
|
|
|
}
|