diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 76731f0..a2c8d4d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -251,7 +251,7 @@ public class SysRoleController extends BaseController /** * 获取对应角色部门树列表 */ - @PreAuthorize("@ss.hasPermi('system:role:list')") + @PreAuthorize("@ss.hasPermi('system:role:query')") @GetMapping(value = "/deptTree/{roleId}") public AjaxResult deptTree(@PathVariable("roleId") Long roleId) { @@ -260,5 +260,4 @@ public class SysRoleController extends BaseController ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); return ajax; } - } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java index 737c9d5..c6c7797 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java @@ -12,11 +12,6 @@ public class UserConstants */ public static final String SYS_USER = "SYS_USER"; - /** - * ss标记的权限字符 - */ - public static final String SS_PERMISSION = "SS_PERMISSION"; - /** 正常状态 */ public static final String NORMAL = "0"; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java index fcd93b6..2fcd65b 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java @@ -1,5 +1,9 @@ package com.ruoyi.framework.security.context; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import com.ruoyi.common.core.text.Convert; + /** * 权限信息 * @@ -7,15 +11,17 @@ package com.ruoyi.framework.security.context; */ public class PermissionContextHolder { - private static final ThreadLocal contextHolder = new ThreadLocal<>(); + private static final String PERMISSION_CONTEXT_ATTRIBUTES = "PERMISSION_CONTEXT"; public static void setContext(String permission) { - contextHolder.set(permission); + RequestContextHolder.currentRequestAttributes().setAttribute(PERMISSION_CONTEXT_ATTRIBUTES, permission, + RequestAttributes.SCOPE_REQUEST); } public static String getContext() { - return contextHolder.get(); + return Convert.toStr(RequestContextHolder.currentRequestAttributes().getAttribute(PERMISSION_CONTEXT_ATTRIBUTES, + RequestAttributes.SCOPE_REQUEST)); } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 08157b6..56669a7 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -89,6 +89,10 @@ public class SysLoginService throw new ServiceException(e.getMessage()); } } + finally + { + AuthenticationContextHolder.clearContext(); + } AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); LoginUser loginUser = (LoginUser) authentication.getPrincipal(); recordLoginInfo(loginUser.getUserId()); diff --git a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml index a8dc0b9..e90f6ba 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml @@ -118,7 +118,6 @@ where m.status = '0' and rm.role_id = #{roleId} -