From ac0372cd9cdff4a0e31ecc70fee2b84e5b2ec4c8 Mon Sep 17 00:00:00 2001 From: du <1725534722@qq.com> Date: Tue, 19 Nov 2024 09:09:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E4=BA=A7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/tc/controller/AssetCurrentController.java | 6 ++---- .../main/java/com/ruoyi/tc/controller/UnitController.java | 2 +- .../java/com/ruoyi/framework/config/SecurityConfig.java | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetCurrentController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetCurrentController.java index a497979..6834f6b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetCurrentController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetCurrentController.java @@ -63,11 +63,9 @@ public class AssetCurrentController extends BaseController { Page page = new Page<>(); page.setSize(as.getSize()); page.setCurrent(as.getCurrent()); - String nickName = null; try { - if (!SecurityUtils.getLoginUser().getUser().isAdmin() || !SecurityUtils.hasRole("common")) { - nickName = SecurityUtils.getLoginUser().getUser().getNickName(); - as.setDwmc(nickName); + if (!SecurityUtils.getLoginUser().getUser().isAdmin() && !SecurityUtils.hasRole("common")) { + as.setDwmc(SecurityUtils.getLoginUser().getUser().getNickName()); } } catch (Exception e) { throw new ServiceException("获取用户信息异常"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/UnitController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/UnitController.java index 8cd59f0..5951c73 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/UnitController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/UnitController.java @@ -30,7 +30,7 @@ import java.util.List; */ @Api(tags = "单位表控制层") @RestController -//@PreAuthorize("@ss.hasAnyRoles('admin,common')") +@PreAuthorize("@ss.hasAnyRoles('admin,common')") @RequestMapping("/tc/unit") public class UnitController { diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 4b138e6..033a7e3 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -115,7 +115,7 @@ public class SecurityConfig // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() - .antMatchers("/tc/**").permitAll() +// .antMatchers("/tc/**").permitAll() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated(); })