|
@@ -1,6 +1,7 @@
|
|
package cn.vber.common.satoken.core.service;
|
|
package cn.vber.common.satoken.core.service;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpInterface;
|
|
import cn.dev33.satoken.stp.StpInterface;
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.vber.common.core.domain.model.LoginUser;
|
|
import cn.vber.common.core.domain.model.LoginUser;
|
|
import cn.vber.common.core.enums.UserType;
|
|
import cn.vber.common.core.enums.UserType;
|
|
@@ -26,7 +27,10 @@ public class SaPermissionImpl implements StpInterface {
|
|
@Override
|
|
@Override
|
|
public List<String> getPermissionList(Object loginId, String loginType) {
|
|
public List<String> getPermissionList(Object loginId, String loginType) {
|
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
|
- if (ObjectUtil.isNull(loginUser) || !loginUser.getLoginId().equals(loginId)) {
|
|
|
|
|
|
+ if (ObjectUtil.isNull(loginUser)) {
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ if (!loginUser.getLoginId().equals(loginId)) {
|
|
PermissionService permissionService = getPermissionService();
|
|
PermissionService permissionService = getPermissionService();
|
|
if (ObjectUtil.isNotNull(permissionService)) {
|
|
if (ObjectUtil.isNotNull(permissionService)) {
|
|
List<String> list = StringUtils.splitList(loginId.toString(), ":");
|
|
List<String> list = StringUtils.splitList(loginId.toString(), ":");
|
|
@@ -35,12 +39,21 @@ public class SaPermissionImpl implements StpInterface {
|
|
throw new ServiceException("PermissionService 实现类不存在");
|
|
throw new ServiceException("PermissionService 实现类不存在");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // 判断是否为超级管理员
|
|
|
|
+ if (LoginHelper.isSuperAdmin(loginUser.getUserId())) {
|
|
|
|
+ // 返回通配符权限,代表拥有所有权限
|
|
|
|
+ return List.of("*");
|
|
|
|
+ }
|
|
UserType userType = UserType.getUserType(loginUser.getUserType());
|
|
UserType userType = UserType.getUserType(loginUser.getUserType());
|
|
if (userType == UserType.APP_USER) {
|
|
if (userType == UserType.APP_USER) {
|
|
- // 其他端 自行根据业务编写
|
|
|
|
|
|
+ // 其用户类型 自行根据业务编写
|
|
|
|
+ }
|
|
|
|
+ if (CollUtil.isNotEmpty(loginUser.getMenuPermission())) {
|
|
|
|
+ // SYS_USER 默认返回权限
|
|
|
|
+ return new ArrayList<>(loginUser.getMenuPermission());
|
|
|
|
+ } else {
|
|
|
|
+ return new ArrayList<>();
|
|
}
|
|
}
|
|
- // SYS_USER 默认返回权限
|
|
|
|
- return new ArrayList<>(loginUser.getMenuPermission());
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|