publish 2.0.0.rc18

This commit is contained in:
曾文豪
2024-08-08 11:11:40 +08:00
parent f5dfce08ed
commit 2c9519a35e
15 changed files with 36 additions and 30 deletions

22
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
<packaging>pom</packaging>
<name>springboot-parent</name>
<description>杭州铁晟科技有限公司基础依赖</description>
@@ -58,61 +58,61 @@
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-database</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-login</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-web</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-util</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-platform</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-message</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-encrypt</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-role</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-annotation</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-poi</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</dependency>
<dependency>

View File

@@ -6,11 +6,11 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</parent>
<artifactId>springboot-ademo</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</parent>
<artifactId>springboot-annotation</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</parent>
<artifactId>springboot-database</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</parent>
<artifactId>springboot-encrypt</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</parent>
<artifactId>springboot-login</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</parent>
<artifactId>springboot-message</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</parent>
<artifactId>springboot-platform</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</parent>
<artifactId>springboot-poi</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</parent>
<artifactId>springboot-role</artifactId>

View File

@@ -7,7 +7,6 @@ import cn.hutool.core.lang.Validator;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tiesheng.annotation.role.RoleAuthority;
import com.tiesheng.role.config.RoleAuthorityAspect;
import com.tiesheng.role.mapper.*;
import com.tiesheng.role.pojos.dao.CoreRoleAuthority;
import com.tiesheng.role.pojos.dao.CoreRoleGroup;
@@ -162,7 +161,7 @@ public class CoreRoleService extends TsServiceBase<CoreRoleGroupMapper, CoreRole
* 当授权发生变化时
*/
public void onRoleChange(String roleId, String userId) {
TsCacheService.of().keys(StrUtil.format(RoleAuthorityAspect.CACHE_HAS_AUTHORITY,
TsCacheService.of().keys(StrUtil.format(TsAuthorityHandler.CACHE_HAS_AUTHORITY,
roleId, userId)).forEach(key -> TsCacheService.of().remove(key));
}

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</parent>
<artifactId>springboot-util</artifactId>

View File

@@ -9,6 +9,8 @@ import java.util.List;
@Service
public interface TsAuthorityHandler {
String CACHE_HAS_AUTHORITY = "CACHE:HAS_AUTHORITY:{}:{}";
/**
* 添加所有的权限

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.0.rc17</version>
<version>2.0.0.rc18</version>
</parent>
<artifactId>springboot-web</artifactId>

View File

@@ -1,8 +1,9 @@
package com.tiesheng.role.config;
package com.tiesheng.web.config.role;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.tiesheng.annotation.role.RoleAuthority;
import com.tiesheng.annotation.token.TokenIgnore;
import com.tiesheng.util.ServletKit;
import com.tiesheng.util.config.TsTokenConfig;
import com.tiesheng.util.exception.ApiException;
@@ -24,8 +25,6 @@ import java.util.stream.Collectors;
@Component
public class RoleAuthorityAspect {
public static final String CACHE_HAS_AUTHORITY = "CACHE:HAS_AUTHORITY:{}:{}";
@Resource
TsTokenConfig tsTokenConfig;
@Resource
@@ -43,9 +42,16 @@ public class RoleAuthorityAspect {
return;
}
// 忽略TOKEN时不校验
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
TokenIgnore tokenIgnore = signature.getMethod().getAnnotation(TokenIgnore.class);
if (tokenIgnore != null) {
return;
}
HttpServletRequest request = ServletKit.getRequest();
TokenBean tokenBean = tsTokenConfig.validToken(request, true);
String cacheKey = StrUtil.format(CACHE_HAS_AUTHORITY, tokenBean.getRoleId(), tokenBean.getId());
String cacheKey = StrUtil.format(TsAuthorityHandler.CACHE_HAS_AUTHORITY, tokenBean.getRoleId(), tokenBean.getId());
List<String> authorityList = StrUtil.split(TsCacheService.of().get(cacheKey), ";")
.stream().filter(StrUtil::isNotEmpty).collect(Collectors.toList());
if (CollUtil.isEmpty(authorityList)) {
@@ -56,7 +62,6 @@ public class RoleAuthorityAspect {
}
String authority = StrUtil.join("_", classAnnotation.group(), classAnnotation.value());
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
RoleAuthority annotation = signature.getMethod().getAnnotation(RoleAuthority.class);
if (annotation != null) {
// 检查是否是功能点的权限