diff --git a/backend/src/main/java/io/dataease/base/domain/Datasource.java b/backend/src/main/java/io/dataease/base/domain/Datasource.java index 5becfe9cb8..3562adbf6b 100644 --- a/backend/src/main/java/io/dataease/base/domain/Datasource.java +++ b/backend/src/main/java/io/dataease/base/domain/Datasource.java @@ -13,6 +13,8 @@ public class Datasource implements Serializable { private String type; + private String createBy; + private Long createTime; private Long updateTime; diff --git a/backend/src/main/java/io/dataease/base/domain/DatasourceExample.java b/backend/src/main/java/io/dataease/base/domain/DatasourceExample.java index 10d246da35..f38a5ecef4 100644 --- a/backend/src/main/java/io/dataease/base/domain/DatasourceExample.java +++ b/backend/src/main/java/io/dataease/base/domain/DatasourceExample.java @@ -384,6 +384,76 @@ public class DatasourceExample { return (Criteria) this; } + public Criteria andCreateByIsNull() { + addCriterion("create_by is null"); + return (Criteria) this; + } + + public Criteria andCreateByIsNotNull() { + addCriterion("create_by is not null"); + return (Criteria) this; + } + + public Criteria andCreateByEqualTo(String value) { + addCriterion("create_by =", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotEqualTo(String value) { + addCriterion("create_by <>", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByGreaterThan(String value) { + addCriterion("create_by >", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByGreaterThanOrEqualTo(String value) { + addCriterion("create_by >=", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLessThan(String value) { + addCriterion("create_by <", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLessThanOrEqualTo(String value) { + addCriterion("create_by <=", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLike(String value) { + addCriterion("create_by like", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotLike(String value) { + addCriterion("create_by not like", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByIn(List values) { + addCriterion("create_by in", values, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotIn(List values) { + addCriterion("create_by not in", values, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByBetween(String value1, String value2) { + addCriterion("create_by between", value1, value2, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotBetween(String value1, String value2) { + addCriterion("create_by not between", value1, value2, "createBy"); + return (Criteria) this; + } + public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; diff --git a/backend/src/main/java/io/dataease/base/mapper/DatasourceMapper.xml b/backend/src/main/java/io/dataease/base/mapper/DatasourceMapper.xml index f5670c69f5..61e0549ca6 100644 --- a/backend/src/main/java/io/dataease/base/mapper/DatasourceMapper.xml +++ b/backend/src/main/java/io/dataease/base/mapper/DatasourceMapper.xml @@ -6,6 +6,7 @@ + @@ -71,7 +72,7 @@ - id, `name`, `desc`, `type`, create_time, update_time + id, `name`, `desc`, `type`, create_by, create_time, update_time configuration @@ -126,11 +127,11 @@ insert into datasource (id, `name`, `desc`, - `type`, create_time, update_time, - configuration) + `type`, create_by, create_time, + update_time, configuration) values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, - #{type,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, - #{configuration,jdbcType=LONGVARCHAR}) + #{type,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, + #{updateTime,jdbcType=BIGINT}, #{configuration,jdbcType=LONGVARCHAR}) insert into datasource @@ -147,6 +148,9 @@ `type`, + + create_by, + create_time, @@ -170,6 +174,9 @@ #{type,jdbcType=VARCHAR}, + + #{createBy,jdbcType=VARCHAR}, + #{createTime,jdbcType=BIGINT}, @@ -202,6 +209,9 @@ `type` = #{record.type,jdbcType=VARCHAR}, + + create_by = #{record.createBy,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, @@ -222,6 +232,7 @@ `name` = #{record.name,jdbcType=VARCHAR}, `desc` = #{record.desc,jdbcType=VARCHAR}, `type` = #{record.type,jdbcType=VARCHAR}, + create_by = #{record.createBy,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT}, configuration = #{record.configuration,jdbcType=LONGVARCHAR} @@ -235,6 +246,7 @@ `name` = #{record.name,jdbcType=VARCHAR}, `desc` = #{record.desc,jdbcType=VARCHAR}, `type` = #{record.type,jdbcType=VARCHAR}, + create_by = #{record.createBy,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT} @@ -253,6 +265,9 @@ `type` = #{type,jdbcType=VARCHAR}, + + create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, @@ -270,6 +285,7 @@ set `name` = #{name,jdbcType=VARCHAR}, `desc` = #{desc,jdbcType=VARCHAR}, `type` = #{type,jdbcType=VARCHAR}, + create_by = #{createBy,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT}, configuration = #{configuration,jdbcType=LONGVARCHAR} @@ -280,6 +296,7 @@ set `name` = #{name,jdbcType=VARCHAR}, `desc` = #{desc,jdbcType=VARCHAR}, `type` = #{type,jdbcType=VARCHAR}, + create_by = #{createBy,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT} where id = #{id,jdbcType=VARCHAR} diff --git a/backend/src/main/java/io/dataease/controller/sys/SysAuthController.java b/backend/src/main/java/io/dataease/controller/sys/SysAuthController.java index 49844ae212..853c6cacad 100644 --- a/backend/src/main/java/io/dataease/controller/sys/SysAuthController.java +++ b/backend/src/main/java/io/dataease/controller/sys/SysAuthController.java @@ -4,6 +4,7 @@ import io.dataease.base.domain.SysAuth; import io.dataease.base.domain.SysAuthDetail; import io.dataease.base.domain.SysDept; import io.dataease.controller.ResultHolder; +import io.dataease.controller.handler.annotation.I18n; import io.dataease.controller.request.BaseTreeRequest; import io.dataease.controller.request.SysAuthDetailRequest; import io.dataease.controller.request.SysAuthRequest; @@ -49,6 +50,7 @@ public class SysAuthController { @ApiOperation("查询授权模板") @GetMapping("/authDetailsModel/{authType}") + @I18n public ListauthDetailsModel(@PathVariable String authType){ return sysAuthService.searchAuthDetailsModel(authType); } diff --git a/backend/src/main/java/io/dataease/datasource/service/DatasourceService.java b/backend/src/main/java/io/dataease/datasource/service/DatasourceService.java index e96026a5d7..99d682c73e 100644 --- a/backend/src/main/java/io/dataease/datasource/service/DatasourceService.java +++ b/backend/src/main/java/io/dataease/datasource/service/DatasourceService.java @@ -51,6 +51,7 @@ public class DatasourceService { datasource.setId(UUID.randomUUID().toString()); datasource.setUpdateTime(currentTimeMillis); datasource.setCreateTime(currentTimeMillis); + datasource.setCreateBy(String.valueOf(AuthUtils.getUser().getUserId())); datasourceMapper.insertSelective(datasource); return datasource; } diff --git a/backend/src/main/resources/db/migration/V3__init_data.sql b/backend/src/main/resources/db/migration/V3__init_data.sql index e84d6c7283..77fbbec7c5 100644 --- a/backend/src/main/resources/db/migration/V3__init_data.sql +++ b/backend/src/main/resources/db/migration/V3__init_data.sql @@ -43,7 +43,7 @@ INSERT INTO `sys_menu` VALUES (37, 1, 0, 1, '组织表单', '组织表单', 'sys INSERT INTO `sys_menu` VALUES (38, 1, 0, 1, '角色表单', '角色表单', 'system/role/form', 13, '', 'role-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES (39, 0, 0, 1, '数据源表单', '数据源表单', 'system/datasource/form', 5, NULL, '/ds-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES (40, 1, 0, 1, '模板管理', '模板管理', 'panel/template/index', 13, 'dashboard', 'panel/template/index', NULL, b'0', b'0', 'sysparam:read', NULL, NULL, NULL, 1620444227389); -INSERT INTO `sys_menu` VALUES (41, 1, 0, 1, '权限管理', '权限管理', 'system/permission/index', 14, 'password', 'system/permission/index', b'0', b'0', b'0', 'sysparam:read', NULL, NULL, NULL, 1620447312657); +INSERT INTO `sys_menu` VALUES (41, 1, 0, 1, '权限管理', '权限管理', 'system/authority/index', 14, 'password', 'system/authority/index', b'0', b'0', b'0', 'sysparam:read', NULL, NULL, NULL, 1620447312657); INSERT INTO `sys_menu` VALUES (50, 0, 0, 1, '个人信息', '个人信息', 'system/user/privateForm', 999, NULL, '/person-info', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES (51, 0, 0, 1, '重置密码', '重置密码', 'system/user/personPwd', 999, NULL, '/person-pwd', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL); INSERT INTO `sys_menu` VALUES (52, 1, 0, 1, '关于', '关于', 'system/about/index', 16, 'system', 'about', b'0', b'0', b'0', NULL, NULL, NULL, NULL, 1620897406691); diff --git a/backend/src/main/resources/db/migration/V5__auth.sql b/backend/src/main/resources/db/migration/V5__auth.sql index e2ac8d8032..05757c961b 100644 --- a/backend/src/main/resources/db/migration/V5__auth.sql +++ b/backend/src/main/resources/db/migration/V5__auth.sql @@ -1,3 +1,18 @@ +/* + Navicat Premium Data Transfer + + Source Server : A-LOCAL-本机数据库 + Source Server Type : MySQL + Source Server Version : 50726 + Source Host : localhost:3306 + Source Schema : data_ease + + Target Server Type : MySQL + Target Server Version : 50726 + File Encoding : 65001 + + Date: 18/05/2021 18:37:45 +*/ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; @@ -41,7 +56,7 @@ CREATE TABLE `sys_auth_detail` ( -- Records of sys_auth_detail -- ---------------------------- BEGIN; -INSERT INTO `sys_auth_detail` VALUES ('chart_manage', 'chart', '管理', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('chart_use', 'chart', '使用', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('dataset_manege', 'dataset', '管理', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('dataset_use', 'dataset', '使用', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('link_manage', 'link', '管理', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('link_user', 'link', '使用', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('panel_export', 'panel', '导出', 3, 0, 'export', '基础权限-导出', 'system', NULL, NULL), ('panel_manage', 'panel', '编辑', 5, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('panel_user', 'panel', '查看', 1, 0, 'view', '基础权限-查看', 'system', NULL, NULL); +INSERT INTO `sys_auth_detail` VALUES ('chart_manage', 'chart', 'i18n_auth_manage', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('chart_use', 'chart', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('dataset_manege', 'dataset', 'i18n_auth_manage', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('dataset_use', 'dataset', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('link_manage', 'link', 'i18n_auth_manage', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('link_user', 'link', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('panel_export', 'panel', 'i18n_auth_export', 3, 0, 'export', '基础权限-导出', 'system', NULL, NULL), ('panel_manage', 'panel', 'i18n_auth_manage', 5, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('panel_user', 'panel', 'i18n_auth_view', 1, 0, 'view', '基础权限-查看', 'system', NULL, NULL); COMMIT; -- ---------------------------- @@ -114,7 +129,7 @@ VALUES authId AS auth_id, sys_auth_detail.privilege_name, sys_auth_detail.privilege_type, - if(sys_auth_detail.privilege_type=1,1,sys_auth_detail.privilege_value), + 1, sys_auth_detail.privilege_extend, sys_auth_detail.remark, 'auto' AS create_user, @@ -143,7 +158,7 @@ select id from sys_auth where sys_auth.auth_source=authSource and sys_auth.auth delete from sys_auth where sys_auth.auth_source=authSource and sys_auth.auth_source_type=authSourceType; -RETURN 'success'; +RETURN 'sucess'; END ;; @@ -165,7 +180,7 @@ select id from sys_auth where sys_auth.auth_target=authTarget and sys_auth.auth delete from sys_auth where sys_auth.auth_target=authTarget and sys_auth.auth_target_type=authTargetType; -RETURN 'success'; +RETURN 'sucess'; END ;; @@ -465,42 +480,3 @@ END delimiter ; SET FOREIGN_KEY_CHECKS = 1; - - - -DROP TRIGGER if exists`new_auth_link`; -DROP TRIGGER if exists`delete_auth_link`; -CREATE TRIGGER `new_auth_link` AFTER INSERT ON `datasource` FOR EACH ROW select copy_auth(NEW.id,'link',NEW.create_by) into @ee; -CREATE TRIGGER `delete_auth_link` AFTER DELETE ON `datasource` FOR EACH ROW select delete_auth_source(OLD.id,'link') into @ee; - -DROP TRIGGER if exists`new_auth_dataset_group`; -DROP TRIGGER if exists`delete_auth_dataset_group`; -DROP TRIGGER if exists`new_auth_dataset_table`; -DROP TRIGGER if exists`delete_auth_dataset_table`; -CREATE TRIGGER `new_auth_dataset_group` AFTER INSERT ON `dataset_group` FOR EACH ROW select copy_auth(NEW.id,'dataset',NEW.create_by) into @ee; -CREATE TRIGGER `delete_auth_dataset_group` AFTER DELETE ON `dataset_group` FOR EACH ROW select delete_auth_source(OLD.id,'dataset') into @ee; -CREATE TRIGGER `new_auth_dataset_table` AFTER INSERT ON `dataset_table` FOR EACH ROW select copy_auth(NEW.id,'dataset',NEW.create_by) into @ee; -CREATE TRIGGER `delete_auth_dataset_table` AFTER DELETE ON `dataset_table` FOR EACH ROW select delete_auth_source(OLD.id,'dataset') into @ee; - - -DROP TRIGGER if exists `new_auth_chart_group`; -DROP TRIGGER if exists`delete_auth_chart_group`; -DROP TRIGGER if exists`new_auth_chart_view`; -DROP TRIGGER if exists`delete_auth_chart_view`; -CREATE TRIGGER `new_auth_chart_group` AFTER INSERT ON `chart_group` FOR EACH ROW select copy_auth(NEW.id,'chart',NEW.create_by) into @ee; -CREATE TRIGGER `delete_auth_chart_group` AFTER DELETE ON `chart_group` FOR EACH ROW select delete_auth_source(OLD.id,'chart') into @ee; -CREATE TRIGGER `new_auth_chart_view` AFTER INSERT ON `chart_view` FOR EACH ROW select copy_auth(NEW.id,'chart',NEW.create_by) into @ee; -CREATE TRIGGER `delete_auth_chart_view` AFTER DELETE ON `chart_view` FOR EACH ROW select delete_auth_source(OLD.id,'chart') into @ee; - -DROP TRIGGER if exists`new_auth_panel`; -DROP TRIGGER if exists`delete_auth_panel`; -CREATE TRIGGER `new_auth_panel` AFTER INSERT ON `panel_group` FOR EACH ROW select copy_auth(NEW.id,'panel',NEW.create_by) into @ee; -CREATE TRIGGER `delete_auth_panel` AFTER DELETE ON `panel_group` FOR EACH ROW select delete_auth_source(OLD.id,'panel') into @ee; - - -DROP TRIGGER if exists`delete_auth_user_target`; -DROP TRIGGER if exists`delete_auth_role_target`; -DROP TRIGGER if exists`delete_auth_dept_target`; -CREATE TRIGGER `delete_auth_user_target` AFTER DELETE ON `sys_user` FOR EACH ROW select delete_auth_target(OLD.user_id,'user') into @ee; -CREATE TRIGGER `delete_auth_role_target` AFTER DELETE ON `sys_role` FOR EACH ROW select delete_auth_target(OLD.role_id,'role') into @ee; -CREATE TRIGGER `delete_auth_dept_target` AFTER DELETE ON `sys_dept` FOR EACH ROW select delete_auth_target(OLD.dept_id,'dept') into @ee; diff --git a/backend/src/main/resources/generatorConfig.xml b/backend/src/main/resources/generatorConfig.xml index ce413c73e6..6c1bc0b05e 100644 --- a/backend/src/main/resources/generatorConfig.xml +++ b/backend/src/main/resources/generatorConfig.xml @@ -64,14 +64,14 @@ - + -
-
+ + diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index fe69987173..bff38df6ca 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -220,4 +220,9 @@ authsource_configuration_is_null=Authentication source configuration cannot be e 视图=View 角色管理=Role management 角色表单=Role Form -重置密码=Reset Password \ No newline at end of file +重置密码=Reset Password + +i18n_auth_view=View +i18n_auth_use=Use +i18n_auth_export=Export +i18n_auth_manage=Manage diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 9aa1574245..da226999a2 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -222,3 +222,8 @@ authsource_configuration_is_null=认证源配置不能为空 角色管理=角色管理 角色表单=角色表单 重置密码=重置密码 + +i18n_auth_view=查看 +i18n_auth_use=使用 +i18n_auth_export=导出 +i18n_auth_manage=管理 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 8f3f6025f8..e5764aa65a 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -222,3 +222,8 @@ authsource_configuration_is_null=認證源配置不能為空 角色管理=角色管理 角色表单=角色表單 重置密码=重置密碼 + +i18n_auth_view=查看 +i18n_auth_use=使用 +i18n_auth_export=導出 +i18n_auth_manage=管理 diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 6c0fe25b59..2a67bf6c00 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -894,5 +894,27 @@ export default { loginImage: 'Picture on the right side of the login page', loginTitle: 'Login page title', title: 'System name' + }, + auth: { + authConfig: 'Auth Config', + authQuickConfig: 'Auth Quick Config', + dept: 'Dept', + role: 'Role', + user: 'User', + linkAuth: 'Datasource Permissions', + datasetAuth: 'Data Permissions', + chartAuth: 'Chart Permissions', + panelAuth: 'Panel Permissions', + deptHead: 'All Dept', + roleHead: 'All Role', + userHead: 'All User', + linkAuthHead: 'All Datasource', + datasetAuthHead: 'All Data', + chartAuthHead: 'All Chart', + panelAuthHead: 'All Chart', + view: 'View', + use: 'Use', + export: 'Export', + manage: 'Manage' } } diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 6553f460b9..a58a0d3462 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -894,5 +894,27 @@ export default { loginImage: '登陸頁面右側圖片', loginTitle: '登陸頁面標題', title: '系統名稱' + }, + auth: { + authConfig: '權限配置', + authQuickConfig: '權限快捷配置', + dept: '部門', + role: '角色', + user: '用戶', + linkAuth: '數據源權限', + datasetAuth: '數據權限', + chartAuth: '視圖權限', + panelAuth: '儀表盤權限', + deptHead: '所有部門', + roleHead: '所有角色', + userHead: '所有用戶', + linkAuthHead: '所有數據源', + datasetAuthHead: '所有數據', + chartAuthHead: '所有視圖', + panelAuthHead: '所有儀表盤', + view: '查看', + use: '使用', + export: '導出', + manage: '管理' } } diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 552d459159..8bfd34f621 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -895,5 +895,27 @@ export default { loginImage: '登录页面右侧图片', loginTitle: '登录页面标题', title: '系统名称' + }, + auth: { + authConfig: '权限配置', + authQuickConfig: '权限快捷配置', + dept: '部门', + role: '角色', + user: '用户', + linkAuth: '数据源权限', + datasetAuth: '数据权限', + chartAuth: '视图权限', + panelAuth: '仪表盘权限', + deptHead: '所有部门', + roleHead: '所有角色', + userHead: '所有用户', + linkAuthHead: '所有数据源', + datasetAuthHead: '所有数据', + chartAuthHead: '所有视图', + panelAuthHead: '所有仪表盘', + view: '查看', + use: '使用', + export: '导出', + manage: '管理' } } diff --git a/frontend/src/views/system/authority/authConfig.vue b/frontend/src/views/system/authority/authConfig.vue index 3bb0928228..46662d7b93 100644 --- a/frontend/src/views/system/authority/authConfig.vue +++ b/frontend/src/views/system/authority/authConfig.vue @@ -1,6 +1,6 @@