-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 适配 ContiNew Starter 脱敏模块(安全模块)
- Loading branch information
Showing
3 changed files
with
22 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,12 @@ | |
|
||
package top.charles7c.continew.admin.auth.model.resp; | ||
|
||
import cn.hutool.core.util.DesensitizedUtil; | ||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
import top.charles7c.continew.admin.common.enums.GenderEnum; | ||
import top.charles7c.continew.starter.security.mask.annotation.JsonMask; | ||
import top.charles7c.continew.starter.security.mask.enums.MaskType; | ||
|
||
import java.io.Serial; | ||
import java.io.Serializable; | ||
|
@@ -68,13 +69,15 @@ public class UserInfoResp implements Serializable { | |
/** | ||
* 邮箱 | ||
*/ | ||
@Schema(description = "邮箱", example = "[email protected]") | ||
@Schema(description = "邮箱", example = "c*******@126.com") | ||
@JsonMask(MaskType.EMAIL) | ||
private String email; | ||
|
||
/** | ||
* 手机号码 | ||
*/ | ||
@Schema(description = "手机号码", example = "13811111111") | ||
@Schema(description = "手机号码", example = "188****8888") | ||
@JsonMask(MaskType.MOBILE_PHONE) | ||
private String phone; | ||
|
||
/** | ||
|
@@ -131,14 +134,6 @@ public class UserInfoResp implements Serializable { | |
@Schema(description = "角色编码集合", example = "[\"test\"]") | ||
private Set<String> roles; | ||
|
||
public String getEmail() { | ||
return DesensitizedUtil.email(email); | ||
} | ||
|
||
public String getPhone() { | ||
return DesensitizedUtil.mobilePhone(phone); | ||
} | ||
|
||
public LocalDate getRegistrationDate() { | ||
return createTime.toLocalDate(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,19 +16,17 @@ | |
|
||
package top.charles7c.continew.admin.system.model.resp; | ||
|
||
import java.io.Serial; | ||
import java.util.Objects; | ||
|
||
import lombok.Data; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
import cn.hutool.core.util.DesensitizedUtil; | ||
|
||
import lombok.Data; | ||
import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum; | ||
import top.charles7c.continew.admin.common.enums.GenderEnum; | ||
import top.charles7c.continew.admin.common.util.helper.LoginHelper; | ||
import top.charles7c.continew.starter.extension.crud.model.resp.BaseResp; | ||
import top.charles7c.continew.starter.security.mask.annotation.JsonMask; | ||
import top.charles7c.continew.starter.security.mask.enums.MaskType; | ||
|
||
import java.io.Serial; | ||
import java.util.Objects; | ||
|
||
/** | ||
* 用户信息 | ||
|
@@ -70,13 +68,15 @@ public class UserResp extends BaseResp { | |
/** | ||
* 邮箱 | ||
*/ | ||
@Schema(description = "邮箱", example = "[email protected]") | ||
@Schema(description = "邮箱", example = "c*******@126.com") | ||
@JsonMask(MaskType.EMAIL) | ||
private String email; | ||
|
||
/** | ||
* 手机号码 | ||
*/ | ||
@Schema(description = "手机号码", example = "13811111111") | ||
@Schema(description = "手机号码", example = "188****8888") | ||
@JsonMask(MaskType.MOBILE_PHONE) | ||
private String phone; | ||
|
||
/** | ||
|
@@ -97,14 +97,6 @@ public class UserResp extends BaseResp { | |
@Schema(description = "描述", example = "张三描述信息") | ||
private String description; | ||
|
||
public String getEmail() { | ||
return DesensitizedUtil.email(email); | ||
} | ||
|
||
public String getPhone() { | ||
return DesensitizedUtil.mobilePhone(phone); | ||
} | ||
|
||
@Override | ||
public Boolean getDisabled() { | ||
return this.getIsSystem() || Objects.equals(this.getId(), LoginHelper.getUserId()); | ||
|