✨ Introducing new features. close #3394 【用户信息】扩展用户基本信息增加部分扩展字段
This commit is contained in:
1 parent
3dab2a3405
commit
56624074de
6 files changed
+15
-17
No files matched your search
+4
-4
@@ -753,6 +753,9 @@ CREATE TABLE `sys_user` (
|
||||
`salt` varchar(255) DEFAULT NULL,
|
||||
`phone` varchar(20) DEFAULT NULL,
|
||||
`avatar` varchar(255) DEFAULT NULL,
|
||||
`nickname` varchar(64) DEFAULT NULL COMMENT '拓展字段:昵称',
|
||||
`name` varchar(64) DEFAULT NULL COMMENT '拓展字段:姓名',
|
||||
`email` varchar(128) DEFAULT NULL COMMENT '拓展字段:邮箱',
|
||||
`dept_id` int(11) DEFAULT NULL COMMENT '部门ID',
|
||||
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
@@ -764,9 +767,6 @@ CREATE TABLE `sys_user` (
|
||||
`gitee_login` varchar(100) DEFAULT NULL COMMENT '码云 标识',
|
||||
`osc_id` varchar(100) DEFAULT NULL COMMENT '开源中国 标识',
|
||||
`tenant_id` int(11) NOT NULL DEFAULT '0' COMMENT '所属租户',
|
||||
`nickname` varchar(255) DEFAULT NULL COMMENT '拓展字段:昵称',
|
||||
`name` varchar(64) DEFAULT NULL COMMENT '拓展字段:姓名',
|
||||
`email` varchar(255) DEFAULT NULL COMMENT '拓展字段:邮箱',
|
||||
PRIMARY KEY (`user_id`) USING BTREE,
|
||||
KEY `user_wx_openid` (`wx_openid`) USING BTREE,
|
||||
KEY `user_qq_openid` (`qq_openid`) USING BTREE,
|
||||
@@ -777,7 +777,7 @@ CREATE TABLE `sys_user` (
|
||||
-- Records of sys_user
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_user` VALUES (1, 'admin', '$2a$10$IVzj1Wd.ZQdOIWdb1htQjexU94uoNeuk1crlQ9ExVupPi0Iy1uv.C', '', '17034642888', '/admin/sys-file/lengleng/c5a85e0770cd4fe78bc14b63b3bd05ae.jpg', 1, '2018-04-20 07:15:18', '2019-11-02 22:12:11', '0', '0', 'o_0FT0uyg_H1vVy2H0JpSwlVGhWQ', 'oBxPy5E-v82xWGsfzZVzkD3wEX64', NULL, 'log4j', '2303656', 1,NULL,NULL,NULL);
|
||||
INSERT INTO `sys_user` VALUES (1, 'admin', '$2a$10$IVzj1Wd.ZQdOIWdb1htQjexU94uoNeuk1crlQ9ExVupPi0Iy1uv.C', '', '17034642888', '/admin/sys-file/lengleng/c5a85e0770cd4fe78bc14b63b3bd05ae.jpg',NULL,NULL,NULL, 1, '2018-04-20 07:15:18', '2019-11-02 22:12:11', '0', '0', 'o_0FT0uyg_H1vVy2H0JpSwlVGhWQ', 'oBxPy5E-v82xWGsfzZVzkD3wEX64', NULL, 'log4j', '2303656', 1);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
||||
+2
-4
@@ -62,7 +62,6 @@ public class PigxUserAuthenticationConverter implements UserAuthenticationConver
|
||||
/**
|
||||
* Extract information about the user to be used in an access token (i.e. for resource
|
||||
* servers).
|
||||
*
|
||||
* @param authentication an authentication representing a user
|
||||
* @return a map of key values representing the unique information about the user
|
||||
*/
|
||||
@@ -79,7 +78,6 @@ public class PigxUserAuthenticationConverter implements UserAuthenticationConver
|
||||
/**
|
||||
* Inverse of {@link #convertUserAuthentication(Authentication)}. Extracts an
|
||||
* Authentication from a map.
|
||||
*
|
||||
* @param responseMap a map of user information
|
||||
* @return an Authentication representing the user or null if there is none
|
||||
*/
|
||||
@@ -98,7 +96,7 @@ public class PigxUserAuthenticationConverter implements UserAuthenticationConver
|
||||
Integer tenantId = MapUtil.getInt(map, SecurityConstants.DETAILS_TENANT_ID);
|
||||
String phone = MapUtil.getStr(map, SecurityConstants.DETAILS_PHONE);
|
||||
String avatar = MapUtil.getStr(map, SecurityConstants.DETAILS_AVATAR);
|
||||
PigxUser user = new PigxUser(nickname, name, email, id, deptId, phone, avatar, tenantId, username, N_A,
|
||||
PigxUser user = new PigxUser(id, username, deptId, phone, avatar, nickname, name, email, tenantId, N_A,
|
||||
true, true, true, true, authorities);
|
||||
return new UsernamePasswordAuthenticationToken(user, N_A, authorities);
|
||||
}
|
||||
@@ -124,7 +122,7 @@ public class PigxUserAuthenticationConverter implements UserAuthenticationConver
|
||||
log.warn("请求头中的租户ID({})和用户的租户ID({})不一致", headerValue, userValue);
|
||||
// TODO: 不要提示租户ID不对,可能被穷举
|
||||
throw new PigxAuth2Exception(PigxSecurityMessageSourceUtil.getAccessor().getMessage(
|
||||
"AbstractUserDetailsAuthenticationProvider.badTenantId", new Object[]{headerValue},
|
||||
"AbstractUserDetailsAuthenticationProvider.badTenantId", new Object[] { headerValue },
|
||||
"Bad tenant ID"));
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -106,12 +106,12 @@ public class PigxUser extends User {
|
||||
* a parameter or as an element in the <code>GrantedAuthority</code> collection
|
||||
*/
|
||||
@JsonCreator
|
||||
public PigxUser(@JsonProperty("nickname") String nickname, @JsonProperty("name") String name,
|
||||
@JsonProperty("email") String email, @JsonProperty("id") Integer id, @JsonProperty("deptId") Integer deptId,
|
||||
@JsonProperty("phone") String phone, @JsonProperty("avatar") String avatar,
|
||||
@JsonProperty("tenantId") Integer tenantId, @JsonProperty("username") String username,
|
||||
@JsonProperty("password") String password, @JsonProperty("enabled") boolean enabled,
|
||||
@JsonProperty("accountNonExpired") boolean accountNonExpired,
|
||||
public PigxUser(@JsonProperty("id") Integer id, @JsonProperty("username") String username,
|
||||
@JsonProperty("deptId") Integer deptId, @JsonProperty("phone") String phone,
|
||||
@JsonProperty("avatar") String avatar, @JsonProperty("nickname") String nickname,
|
||||
@JsonProperty("name") String name, @JsonProperty("email") String email,
|
||||
@JsonProperty("tenantId") Integer tenantId, @JsonProperty("password") String password,
|
||||
@JsonProperty("enabled") boolean enabled, @JsonProperty("accountNonExpired") boolean accountNonExpired,
|
||||
@JsonProperty("credentialsNonExpired") boolean credentialsNonExpired,
|
||||
@JsonProperty("accountNonLocked") boolean accountNonLocked,
|
||||
@JsonProperty("authorities") Collection<? extends GrantedAuthority> authorities) {
|
||||
|
||||
+2
-2
@@ -113,8 +113,8 @@ public class PigxUserDetailsServiceImpl implements PigxUserDetailsService {
|
||||
boolean enabled = StrUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL);
|
||||
// 构造security用户
|
||||
|
||||
return new PigxUser(user.getNickname(), user.getName(), user.getEmail(), user.getUserId(), user.getDeptId(),
|
||||
user.getPhone(), user.getAvatar(), user.getTenantId(), user.getUsername(),
|
||||
return new PigxUser(user.getUserId(), user.getUsername(), user.getDeptId(), user.getPhone(), user.getAvatar(),
|
||||
user.getNickname(), user.getName(), user.getEmail(), user.getTenantId(),
|
||||
SecurityConstants.BCRYPT + user.getPassword(), enabled, true, true,
|
||||
!CommonConstants.STATUS_LOCK.equals(user.getLockFlag()), authorities);
|
||||
}
|
||||
|
||||
+1
-1
@@ -300,7 +300,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
if (CollUtil.isNotEmpty(errorMessageList)) {
|
||||
return R.failed(errorMessageList);
|
||||
}
|
||||
return R.ok();
|
||||
return R.ok(null, "用户导入成功,默认密码为手机号");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user