可登录的就能看到所有权限

This commit is contained in:
aoli.qu 2023-11-02 15:58:09 +08:00
parent e83235e955
commit 0b239daba2
2 changed files with 41 additions and 3 deletions

View File

@ -9,7 +9,6 @@ import com.org.system.pojo.LoginMenuTreeNode;
import com.org.utils.Constants; import com.org.utils.Constants;
import com.org.utils.MessageUtil; import com.org.utils.MessageUtil;
import com.org.utils.SecurityUtil; import com.org.utils.SecurityUtil;
import com.org.utils.StringUtils;
import com.org.utils.exception.CustomException; import com.org.utils.exception.CustomException;
import com.org.utils.exception.UserPasswordNotMatchException; import com.org.utils.exception.UserPasswordNotMatchException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -125,11 +124,13 @@ public class SysLoginService {
// 获取当前登录账号当前角色的权限 // 获取当前登录账号当前角色的权限
Set<String> permissions = new HashSet<>(); Set<String> permissions = new HashSet<>();
if(SecurityUtil.getLoginUser().ifAdmin()){ /*if(SecurityUtil.getLoginUser().ifAdmin()){
permissions.add(PermissionService.ALL_PERMISSION); permissions.add(PermissionService.ALL_PERMISSION);
} else { } else {
for (SysMenu sysMenu : sysMenuList) { if(StringUtils.isNotEmpty(sysMenu.getPermission())) permissions.add(sysMenu.getPermission()); } for (SysMenu sysMenu : sysMenuList) { if(StringUtils.isNotEmpty(sysMenu.getPermission())) permissions.add(sysMenu.getPermission()); }
} }*/
// todo 可登录的就能看到所有权限
permissions.add(PermissionService.ALL_PERMISSION);
SecurityUtil.getLoginUser().setPermissions(permissions); SecurityUtil.getLoginUser().setPermissions(permissions);
tokenService.refreshToken(SecurityUtil.getLoginUser()); tokenService.refreshToken(SecurityUtil.getLoginUser());

View File

@ -0,0 +1,37 @@
<?xml version="1.0"?>
<configuration debug="false" scan="true" scanPeriod="30 seconds">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径 -->
<property name="LOG_HOME" value="logs"/>
<!-- 定义日志文件名称 -->
<property name="LOG_FILENAME" value="welfare"/>
<!-- 日志输出格式 -->
<property name="LOG_PATTERN" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_HOME}/${LOG_FILENAME}.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${LOG_HOME}/${LOG_FILENAME}.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration>