Commit 034de50999fd321f5284e9c07c2f440193ad44f9
1 parent
b73cdd15
完善多租户的注释与代码
Showing
3 changed files
with
5 additions
and
4 deletions
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/DocumentEnum.java
| @@ -12,7 +12,8 @@ import lombok.Getter; | @@ -12,7 +12,8 @@ import lombok.Getter; | ||
| 12 | @AllArgsConstructor | 12 | @AllArgsConstructor |
| 13 | public enum DocumentEnum { | 13 | public enum DocumentEnum { |
| 14 | 14 | ||
| 15 | - REDIS_INSTALL("https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues/I4VCSJ", "Redis 安装文档"); | 15 | + REDIS_INSTALL("https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues/I4VCSJ", "Redis 安装文档"), |
| 16 | + TENANT("https://doc.iocoder.cn", "SaaS 多租户文档"); | ||
| 16 | 17 | ||
| 17 | private final String url; | 18 | private final String url; |
| 18 | private final String memo; | 19 | private final String memo; |
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java
| 1 | package cn.iocoder.yudao.framework.tenant.core.context; | 1 | package cn.iocoder.yudao.framework.tenant.core.context; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.DocumentEnum; | ||
| 3 | import com.alibaba.ttl.TransmittableThreadLocal; | 4 | import com.alibaba.ttl.TransmittableThreadLocal; |
| 4 | 5 | ||
| 5 | /** | 6 | /** |
| @@ -36,7 +37,8 @@ public class TenantContextHolder { | @@ -36,7 +37,8 @@ public class TenantContextHolder { | ||
| 36 | public static Long getRequiredTenantId() { | 37 | public static Long getRequiredTenantId() { |
| 37 | Long tenantId = getTenantId(); | 38 | Long tenantId = getTenantId(); |
| 38 | if (tenantId == null) { | 39 | if (tenantId == null) { |
| 39 | - throw new NullPointerException("TenantContextHolder 不存在租户编号"); // TODO 芋艿:增加文档链接 | 40 | + throw new NullPointerException("TenantContextHolder 不存在租户编号!可参考文档:" |
| 41 | + + DocumentEnum.TENANT.getUrl()); | ||
| 40 | } | 42 | } |
| 41 | return tenantId; | 43 | return tenantId; |
| 42 | } | 44 | } |
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/security/TenantSecurityWebFilter.java
| @@ -28,8 +28,6 @@ import java.util.Objects; | @@ -28,8 +28,6 @@ import java.util.Objects; | ||
| 28 | * 2. 如果请求未带租户的编号,检查是否是忽略的 URL,否则也不允许访问。 | 28 | * 2. 如果请求未带租户的编号,检查是否是忽略的 URL,否则也不允许访问。 |
| 29 | * 3. 校验租户是合法,例如说被禁用、到期 | 29 | * 3. 校验租户是合法,例如说被禁用、到期 |
| 30 | * | 30 | * |
| 31 | - * 校验用户访问的租户,是否是其所在的租户, | ||
| 32 | - * | ||
| 33 | * @author 芋道源码 | 31 | * @author 芋道源码 |
| 34 | */ | 32 | */ |
| 35 | @Slf4j | 33 | @Slf4j |