From 5b9849506756b62f3f958faf0b2a8110310031e8 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 25 Jun 2024 12:02:23 +0800 Subject: [PATCH 1/9] =?UTF-8?q?cron=E7=94=9F=E6=88=90=E7=9A=84=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8Fhour=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/Crontab/hour.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ruoyi-ui/src/components/Crontab/hour.vue b/ruoyi-ui/src/components/Crontab/hour.vue index 4b1f1fcd..3216c33f 100644 --- a/ruoyi-ui/src/components/Crontab/hour.vue +++ b/ruoyi-ui/src/components/Crontab/hour.vue @@ -51,10 +51,16 @@ export default { methods: { // 单选按钮值变化时 radioChange() { + if (this.cron.min === '*') { + this.$emit('update', 'min', '0', 'hour'); + } + if (this.cron.second === '*') { + this.$emit('update', 'second', '0', 'hour'); + } switch (this.radioValue) { case 1: - this.$emit('update', 'hour', '*') - break; + this.$emit('update', 'hour', '*') + break; case 2: this.$emit('update', 'hour', this.cycleTotal); break; From e14f40670a8a5dacc883b93d196505866d90c0e1 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 25 Jun 2024 12:27:21 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/common/utils/file/FileUploadUtils.java | 2 +- .../main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java | 2 +- ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index 4652a298..5a0ef640 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -25,7 +25,7 @@ public class FileUploadUtils /** * 默认大小 50M */ - public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024; + public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024L; /** * 默认的文件名最大长度 100 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java index ae3a6a28..1543ec5b 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java @@ -152,7 +152,7 @@ public class DataScopeAspect conditions.add(dataScope); } - // 多角色情况下,所有角色都不包含传递过来的权限字符,这个时候sqlString也会为空,所以要限制一下,不查询任何数据 + // 角色都不包含传递过来的权限字符,这个时候sqlString也会为空,所以要限制一下,不查询任何数据 if (StringUtils.isEmpty(conditions)) { sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias)); diff --git a/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm b/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm index 234ac67d..3d2ce77e 100644 --- a/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm +++ b/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm @@ -12,7 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #if($table.sub) - + From 88560a7aa5c5e38e1c5b83a706bce6340bac5162 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 25 Jun 2024 12:28:50 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=8D=87=E7=BA=A7oshi=E5=88=B0=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC6.6.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 42c9b408..e8f431d1 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ 2.3.3 1.4.7 2.0.43 - 6.5.0 + 6.6.1 2.13.0 4.1.2 2.3 From 7b064d84bbfed871f1d999e382a0c33e55f17b60 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 25 Jun 2024 12:29:13 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=8D=87=E7=BA=A7druid=E5=88=B0=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC1.2.23?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e8f431d1..3b0bd27a 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ 1.8 3.1.1 5.3.33 - 1.2.20 + 1.2.23 1.21 3.0.0 2.3.3 From 8eff83e2b4e4e44e31db516b00967b2d5c5ede0a Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 26 Jun 2024 17:40:01 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/system/SysDictDataMapper.xml | 2 +- ruoyi-ui/src/views/system/role/selectUser.vue | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml index 75d80a15..c5e1da9d 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml @@ -41,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by dict_sort asc - where status = '0' and dict_type = #{dictType} order by dict_sort asc diff --git a/ruoyi-ui/src/views/system/role/selectUser.vue b/ruoyi-ui/src/views/system/role/selectUser.vue index e0f83fa2..b4efce81 100644 --- a/ruoyi-ui/src/views/system/role/selectUser.vue +++ b/ruoyi-ui/src/views/system/role/selectUser.vue @@ -127,11 +127,9 @@ export default { } authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => { this.$modal.msgSuccess(res.msg); - if (res.code === 200) { - this.visible = false; - this.$emit("ok"); - } - }); + this.visible = false; + this.$emit("ok"); + }); } } }; From 10f68b97af299c94efffdba118ee6b41fb134a17 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 26 Jun 2024 17:43:14 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=8D=87=E7=BA=A7spring-security=E5=88=B0?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E7=89=88=E6=9C=AC=EF=BC=8C=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E6=BC=8F=E6=B4=9E=E9=A3=8E=E9=99=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 10 ++ .../framework/config/SecurityConfig.java | 99 +++++++++---------- 2 files changed, 55 insertions(+), 54 deletions(-) diff --git a/pom.xml b/pom.xml index 3b0bd27a..de52c2ce 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,7 @@ 1.8 3.1.1 5.3.33 + 5.7.12 1.2.23 1.21 3.0.0 @@ -45,6 +46,15 @@ import + + + org.springframework.security + spring-security-bom + ${spring-security.version} + pom + import + + org.springframework.boot 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 bdb7199f..b04beffb 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 @@ -2,16 +2,17 @@ package com.ruoyi.framework.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.authentication.ProviderManager; +import org.springframework.security.authentication.dao.DaoAuthenticationProvider; +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.logout.LogoutFilter; import org.springframework.web.filter.CorsFilter; @@ -25,8 +26,9 @@ import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; * * @author ruoyi */ -@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) -public class SecurityConfig extends WebSecurityConfigurerAdapter +@EnableMethodSecurity(prePostEnabled = true, securedEnabled = true) +@Configuration +public class SecurityConfig { /** * 自定义用户认证逻辑 @@ -65,16 +67,15 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter private PermitAllUrlProperties permitAllUrl; /** - * 解决 无法直接注入 AuthenticationManager - * - * @return - * @throws Exception + * 身份验证实现 */ @Bean - @Override - public AuthenticationManager authenticationManagerBean() throws Exception + public AuthenticationManager authenticationManager() { - return super.authenticationManagerBean(); + DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider(); + daoAuthenticationProvider.setUserDetailsService(userDetailsService); + daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder()); + return new ProviderManager(daoAuthenticationProvider); } /** @@ -92,40 +93,39 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter * rememberMe | 允许通过remember-me登录的用户访问 * authenticated | 用户登录后可访问 */ - @Override - protected void configure(HttpSecurity httpSecurity) throws Exception + @Bean + protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { - // 注解标记允许匿名访问的url - ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry registry = httpSecurity.authorizeRequests(); - permitAllUrl.getUrls().forEach(url -> registry.antMatchers(url).permitAll()); - - httpSecurity - // CSRF禁用,因为不使用session - .csrf().disable() - // 禁用HTTP响应标头 - .headers().cacheControl().disable().and() - // 认证失败处理类 - .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and() - // 基于token,所以不需要session - .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() - // 过滤请求 - .authorizeRequests() + return httpSecurity + // CSRF禁用,因为不使用session + .csrf(csrf -> csrf.disable()) + // 禁用HTTP响应标头 + .headers((headersCustomizer) -> { + headersCustomizer.cacheControl(cache -> cache.disable()).frameOptions(options -> options.sameOrigin()); + }) + // 认证失败处理类 + .exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler)) + // 基于token,所以不需要session + .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + // 注解标记允许匿名访问的url + .authorizeHttpRequests((requests) -> { + permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - .antMatchers("/login", "/register", "/captchaImage").permitAll() - // 静态资源,可匿名访问 - .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() - .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() - // 除上面外的所有请求全部需要鉴权认证 - .anyRequest().authenticated() - .and() - .headers().frameOptions().disable(); - // 添加Logout filter - httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); - // 添加JWT filter - httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); - // 添加CORS filter - httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class); - httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class); + requests.antMatchers("/login", "/register", "/captchaImage").permitAll() + // 静态资源,可匿名访问 + .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() + .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() + // 除上面外的所有请求全部需要鉴权认证 + .anyRequest().authenticated(); + }) + // 添加Logout filter + .logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler)) + // 添加JWT filter + .addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class) + // 添加CORS filter + .addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class) + .addFilterBefore(corsFilter, LogoutFilter.class) + .build(); } /** @@ -136,13 +136,4 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { return new BCryptPasswordEncoder(); } - - /** - * 身份认证接口 - */ - @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception - { - auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); - } } From 9e8aa1434840450ff665a0fb8807583e566651b9 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 27 Jun 2024 10:22:38 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=A1=A8?= =?UTF-8?q?=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6=E4=BD=BF=E7=94=A8=E5=8F=8D?= =?UTF-8?q?=E6=96=9C=E6=9D=A0=E8=BF=9B=E8=A1=8C=E8=BD=AC=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/generator/GenTableMapper.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml index 8ec82113..5a9e547b 100644 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -79,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select table_name, table_comment, create_time, update_time from information_schema.tables - where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database()) + where table_name NOT LIKE 'qrtz\_%' and table_name NOT LIKE 'gen\_%' and table_schema = (select database()) and table_name in #{name} From 4ec32367fd8c54bf72a79e10a12deb4287306fdd Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 27 Jun 2024 10:22:55 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=8D=87=E7=BA=A7core-js=E5=88=B0=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC3.37.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 0af11e01..ea158d6b 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -39,7 +39,7 @@ "@riophae/vue-treeselect": "0.4.0", "axios": "0.24.0", "clipboard": "2.0.8", - "core-js": "3.25.3", + "core-js": "3.37.1", "echarts": "5.4.0", "element-ui": "2.15.14", "file-saver": "2.0.5", From 8264b8fb3127aadb19a6242c6b69940ad748d941 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 27 Jun 2024 11:08:31 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-common/pom.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 38326a1f..5b3273db 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -59,13 +59,6 @@ jackson-databind - - - com.baomidou - dynamic-datasource-spring-boot-starter - 3.5.2 - - com.alibaba.fastjson2