提交 a988d6ee authored 作者: hzh's avatar hzh

脱敏功能吸怪

上级 6a9744b8
package org.dromara.demo.service.impl; package org.dromara.demo.service.impl;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import org.dromara.common.core.enums.UserType;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.sensitive.core.SensitiveService; import org.dromara.common.sensitive.core.SensitiveService;
...@@ -25,6 +26,9 @@ public class SensitiveServiceImpl implements SensitiveService { ...@@ -25,6 +26,9 @@ public class SensitiveServiceImpl implements SensitiveService {
if (!LoginHelper.isLogin()) { if (!LoginHelper.isLogin()) {
return true; return true;
} }
if (StringUtils.equals(LoginHelper.getUserType().getUserType(), UserType.APP_USER.getUserType())) {
return false;
}
boolean roleExist = StringUtils.isNotBlank(roleKey); boolean roleExist = StringUtils.isNotBlank(roleKey);
boolean permsExist = StringUtils.isNotBlank(perms); boolean permsExist = StringUtils.isNotBlank(perms);
if (roleExist && permsExist) { if (roleExist && permsExist) {
......
package org.dromara.resource; package org.dromara.server;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
......
package org.dromara.resource.controller.airport; package org.dromara.server.controller.airport;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
...@@ -20,7 +20,7 @@ import org.dromara.common.ys.model.res.comomResource.AirportModel; ...@@ -20,7 +20,7 @@ import org.dromara.common.ys.model.res.comomResource.AirportModel;
import org.dromara.common.ys.service.AirPortService; import org.dromara.common.ys.service.AirPortService;
import org.dromara.common.ys.service.CommonResourceService; import org.dromara.common.ys.service.CommonResourceService;
import org.dromara.common.ys.service.InsuranceService; import org.dromara.common.ys.service.InsuranceService;
import org.dromara.resource.base.BaseController; import org.dromara.server.base.BaseController;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
package org.dromara.resource.controller.train; package org.dromara.server.controller.train;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import io.seata.spring.annotation.GlobalTransactional; import io.seata.spring.annotation.GlobalTransactional;
...@@ -13,7 +13,7 @@ import org.dromara.common.ys.model.res.comomResource.CityModel; ...@@ -13,7 +13,7 @@ import org.dromara.common.ys.model.res.comomResource.CityModel;
import org.dromara.common.ys.model.res.train.AllStationModel; import org.dromara.common.ys.model.res.train.AllStationModel;
import org.dromara.common.ys.service.CommonResourceService; import org.dromara.common.ys.service.CommonResourceService;
import org.dromara.common.ys.service.TrainService; import org.dromara.common.ys.service.TrainService;
import org.dromara.resource.base.BaseController; import org.dromara.server.base.BaseController;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
......
package org.dromara.resource.controller.vehicle; package org.dromara.server.controller.vehicle;
import io.seata.spring.annotation.GlobalTransactional; import io.seata.spring.annotation.GlobalTransactional;
...@@ -8,7 +8,7 @@ import org.dromara.common.ys.constant.TripType; ...@@ -8,7 +8,7 @@ import org.dromara.common.ys.constant.TripType;
import org.dromara.common.ys.model.req.vehicles.EstimateJsycPriceModel; import org.dromara.common.ys.model.req.vehicles.EstimateJsycPriceModel;
import org.dromara.common.ys.model.req.vehicles.EstimateYyycPriceModel; import org.dromara.common.ys.model.req.vehicles.EstimateYyycPriceModel;
import org.dromara.common.ys.service.VehiclesService; import org.dromara.common.ys.service.VehiclesService;
import org.dromara.resource.base.BaseController; import org.dromara.server.base.BaseController;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
......
...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService; import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.core.enums.UserStatus; import org.dromara.common.core.enums.UserStatus;
import org.dromara.common.core.enums.UserType;
import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.exception.user.UserException; import org.dromara.common.core.exception.user.UserException;
import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.DateUtils;
...@@ -172,7 +173,7 @@ public class RemoteUserServiceImpl implements RemoteUserService { ...@@ -172,7 +173,7 @@ public class RemoteUserServiceImpl implements RemoteUserService {
loginUser.setUserId(sysUser.getUserId()); loginUser.setUserId(sysUser.getUserId());
loginUser.setUsername(sysUser.getUserName()); loginUser.setUsername(sysUser.getUserName());
loginUser.setNickname(sysUser.getNickName()); loginUser.setNickname(sysUser.getNickName());
loginUser.setUserType(sysUser.getUserType()); loginUser.setUserType(UserType.APP_USER.getUserType());
loginUser.setOpenid(openid); loginUser.setOpenid(openid);
return loginUser; return loginUser;
} }
......
package org.dromara.system.service.impl; package org.dromara.system.service.impl;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import org.dromara.common.core.enums.UserType;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.sensitive.core.SensitiveService; import org.dromara.common.sensitive.core.SensitiveService;
...@@ -26,6 +27,9 @@ public class SysSensitiveServiceImpl implements SensitiveService { ...@@ -26,6 +27,9 @@ public class SysSensitiveServiceImpl implements SensitiveService {
if (!LoginHelper.isLogin()) { if (!LoginHelper.isLogin()) {
return true; return true;
} }
if (StringUtils.equals(LoginHelper.getUserType().getUserType(), UserType.APP_USER.getUserType())) {
return false;
}
boolean roleExist = StringUtils.isNotEmpty(roleKey); boolean roleExist = StringUtils.isNotEmpty(roleKey);
boolean permsExist = StringUtils.isNotEmpty(perms); boolean permsExist = StringUtils.isNotEmpty(perms);
if (roleExist && permsExist) { if (roleExist && permsExist) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论