mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-11-04 22:57:12 +08:00
feat(plugin/tenant): 新增多租户插件模块 (#175)
This commit is contained in:
@@ -80,7 +80,7 @@ public class UserContext implements Serializable {
|
||||
*/
|
||||
private Set<RoleContext> roles;
|
||||
|
||||
/**
|
||||
/*
|
||||
* 客户端类型
|
||||
*/
|
||||
private String clientType;
|
||||
@@ -90,6 +90,11 @@ public class UserContext implements Serializable {
|
||||
*/
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 租户 ID
|
||||
*/
|
||||
private Long tenantId;
|
||||
|
||||
public UserContext(Set<String> permissions, Set<RoleContext> roles, Integer passwordExpirationDays) {
|
||||
this.permissions = permissions;
|
||||
this.setRoles(roles);
|
||||
@@ -129,4 +134,5 @@ public class UserContext implements Serializable {
|
||||
}
|
||||
return this.pwdResetTime.plusDays(this.passwordExpirationDays).isBefore(LocalDateTime.now());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -180,4 +180,11 @@ public class UserContextHolder {
|
||||
StpUtil.checkLogin();
|
||||
return getContext().isAdmin();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租户ID
|
||||
*/
|
||||
public static Long getTenantId() {
|
||||
return ExceptionUtils.exToNull(() -> getContext().getTenantId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user