用户权限重构
This commit is contained in:
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.config.security.UserAuthVo;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserAuth;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserInfo;
|
||||
import com.zyplayer.doc.data.service.manage.UserAuthService;
|
||||
import com.zyplayer.doc.data.service.manage.UserInfoService;
|
||||
@@ -79,7 +81,7 @@ public class LoginController {
|
||||
return DocResponseJson.warn("用户名或密码错误");
|
||||
}
|
||||
}
|
||||
Set<String> userAuthSet = userAuthService.getUserAuthSet(userInfo.getId());
|
||||
List<UserAuthVo> userAuthSet = userAuthService.getUserAuthSet(userInfo.getId());
|
||||
String accessToken = IdUtil.simpleUUID();
|
||||
DocUserDetails userDetails = new DocUserDetails(userInfo.getId(), userInfo.getUserName(), userInfo.getPassword(), true, userAuthSet);
|
||||
DocUserUtil.setCurrentUser(accessToken, userDetails);
|
||||
|
||||
@@ -152,7 +152,9 @@ CREATE TABLE `user_auth` (
|
||||
`del_flag` tinyint(4) NULL DEFAULT 0 COMMENT '是否删除 0=未删除 1=已删除',
|
||||
`creation_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||
`auth_custom_suffix` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '自定义权限结尾',
|
||||
`sys_type` int NULL COMMENT '系统类型,DocSysType',
|
||||
`sys_module_type` int NULL COMMENT '系统模块类型,DocSysModuleType',
|
||||
`sys_module_id` bigint(20) NULL COMMENT '系统模块ID',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 73 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户权限表' ROW_FORMAT = Compact;
|
||||
|
||||
|
||||
@@ -155,7 +155,9 @@ CREATE TABLE `user_auth` (
|
||||
`del_flag` tinyint(4) NULL DEFAULT 0 COMMENT '是否删除 0=未删除 1=已删除',
|
||||
`creation_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||
`auth_custom_suffix` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '自定义权限结尾',
|
||||
`sys_type` int NULL COMMENT '系统类型,DocSysType',
|
||||
`sys_module_type` int NULL COMMENT '系统模块类型,DocSysModuleType',
|
||||
`sys_module_id` bigint(20) NULL COMMENT '系统模块ID',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 73 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户权限表' ROW_FORMAT = Compact;
|
||||
|
||||
|
||||
@@ -58,5 +58,11 @@ CREATE TABLE `api_global_param` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='api文档全局参数记录';
|
||||
|
||||
|
||||
-- 权限表优化
|
||||
ALTER TABLE `user_auth` ADD COLUMN `sys_type` int NULL COMMENT '系统类型,DocSysType',
|
||||
ADD COLUMN `sys_module_type` int NULL COMMENT '系统模块类型,DocSysModuleType',
|
||||
ADD COLUMN `sys_module_id` bigint(20) NULL COMMENT '系统模块ID';
|
||||
-- 历史数据处理
|
||||
update user_auth set sys_type=3, sys_module_type=1, sys_module_id=replace(auth_custom_suffix, 'DB_', '') where auth_custom_suffix like 'DB_%';
|
||||
update user_auth set sys_type=2, sys_module_type=1, sys_module_id=replace(auth_custom_suffix, 'WIKI_', '') where auth_custom_suffix like 'WIKI_%';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user