mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 12:03:05 +08:00
Merge branch 'main' of github.com:dataease/dataease into main
This commit is contained in:
commit
1b73e41063
@ -1,5 +1,6 @@
|
|||||||
package io.dataease.auth.service.impl;
|
package io.dataease.auth.service.impl;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
import io.dataease.auth.api.dto.CurrentRoleDto;
|
import io.dataease.auth.api.dto.CurrentRoleDto;
|
||||||
import io.dataease.auth.entity.SysUserEntity;
|
import io.dataease.auth.entity.SysUserEntity;
|
||||||
import io.dataease.base.domain.SysUser;
|
import io.dataease.base.domain.SysUser;
|
||||||
@ -105,8 +106,11 @@ public class AuthUserServiceImpl implements AuthUserService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public void syncPluginMenu() {
|
public void syncPluginMenu() {
|
||||||
List<PluginSysMenu> pluginSysMenuList = PluginUtils.pluginMenus();
|
List<PluginSysMenu> pluginSysMenuList = PluginUtils.pluginMenus();
|
||||||
extPluginSysMenuMapper.deletePluginMenu();
|
int i = extPluginSysMenuMapper.deletePluginMenu();
|
||||||
|
LogUtil.info("删除插件菜单记录数{}", i);
|
||||||
|
|
||||||
if(CollectionUtils.isNotEmpty(pluginSysMenuList)){
|
if(CollectionUtils.isNotEmpty(pluginSysMenuList)){
|
||||||
|
LogUtil.info("待插入插件菜单记录是"+new Gson().toJson(pluginSysMenuList));
|
||||||
extPluginSysMenuMapper.savePluginMenu(pluginSysMenuList);
|
extPluginSysMenuMapper.savePluginMenu(pluginSysMenuList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryUnion" resultMap="BaseResultMapDTO">
|
<select id="queryUnion" resultMap="BaseResultMapDTO">
|
||||||
select id , name , `desc` ,`type` , configuration ,create_time ,update_time
|
select id , name , `desc` ,`type` , configuration ,create_time ,update_time,
|
||||||
|
get_auths(id,'link',#{userId}) as `privileges`
|
||||||
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'link') cids) t,datasource
|
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'link') cids) t,datasource
|
||||||
<where>
|
<where>
|
||||||
FIND_IN_SET(datasource.id,cids)
|
FIND_IN_SET(datasource.id,cids)
|
||||||
|
@ -11,5 +11,5 @@ public interface ExtPluginSysMenuMapper {
|
|||||||
|
|
||||||
void savePluginMenu(@Param("menuList") List<PluginSysMenu> menuList);
|
void savePluginMenu(@Param("menuList") List<PluginSysMenu> menuList);
|
||||||
|
|
||||||
void deletePluginMenu();
|
int deletePluginMenu();
|
||||||
}
|
}
|
||||||
|
@ -16,5 +16,8 @@ public interface ExtSysAuthMapper {
|
|||||||
@Param("authTarget") String authTarget,
|
@Param("authTarget") String authTarget,
|
||||||
@Param("authTargetType") String authTargetType);
|
@Param("authTargetType") String authTargetType);
|
||||||
|
|
||||||
|
Boolean checkTreeNoManageCount(@Param("userId") Long userId , @Param("modelType") String modelType, @Param("nodeId") String nodeId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,4 +70,8 @@
|
|||||||
select id from sys_auth where auth_source=#{authSource} and auth_source_type=#{authSourceType} and auth_target=#{authTarget} and auth_target_type=#{authTargetType} limit 1
|
select id from sys_auth where auth_source=#{authSource} and auth_source_type=#{authSourceType} and auth_target=#{authTarget} and auth_target_type=#{authTargetType} limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="checkTreeNoManageCount" resultType="Boolean">
|
||||||
|
select if(CHECK_TREE_NO_MANAGE_PRIVILEGE(#{userId},#{modelType},#{nodeId})>0,1,0)
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -11,10 +11,12 @@ import io.dataease.controller.request.chart.ChartGroupRequest;
|
|||||||
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
||||||
import io.dataease.dto.chart.ChartGroupDTO;
|
import io.dataease.dto.chart.ChartGroupDTO;
|
||||||
import io.dataease.i18n.Translator;
|
import io.dataease.i18n.Translator;
|
||||||
|
import io.dataease.service.sys.SysAuthService;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -34,6 +36,8 @@ public class ChartGroupService {
|
|||||||
private ExtChartGroupMapper extChartGroupMapper;
|
private ExtChartGroupMapper extChartGroupMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ExtDataSetGroupMapper extDataSetGroupMapper;
|
private ExtDataSetGroupMapper extDataSetGroupMapper;
|
||||||
|
@Resource
|
||||||
|
private SysAuthService sysAuthService;
|
||||||
|
|
||||||
public ChartGroupDTO save(ChartGroup chartGroup) {
|
public ChartGroupDTO save(ChartGroup chartGroup) {
|
||||||
checkName(chartGroup);
|
checkName(chartGroup);
|
||||||
@ -52,6 +56,9 @@ public class ChartGroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void delete(String id) {
|
public void delete(String id) {
|
||||||
|
Assert.notNull(id, "id cannot be null");
|
||||||
|
sysAuthService.checkTreeNoManageCount("chart",id);
|
||||||
|
|
||||||
ChartGroup cg = chartGroupMapper.selectByPrimaryKey(id);
|
ChartGroup cg = chartGroupMapper.selectByPrimaryKey(id);
|
||||||
ChartGroupRequest ChartGroup = new ChartGroupRequest();
|
ChartGroupRequest ChartGroup = new ChartGroupRequest();
|
||||||
BeanUtils.copyBean(ChartGroup, cg);
|
BeanUtils.copyBean(ChartGroup, cg);
|
||||||
|
@ -13,11 +13,13 @@ import io.dataease.controller.request.dataset.DataSetTableRequest;
|
|||||||
import io.dataease.dto.dataset.DataSetGroupDTO;
|
import io.dataease.dto.dataset.DataSetGroupDTO;
|
||||||
import io.dataease.dto.dataset.DataSetTableDTO;
|
import io.dataease.dto.dataset.DataSetTableDTO;
|
||||||
import io.dataease.i18n.Translator;
|
import io.dataease.i18n.Translator;
|
||||||
|
import io.dataease.service.sys.SysAuthService;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -36,6 +38,8 @@ public class DataSetGroupService {
|
|||||||
private DataSetTableService dataSetTableService;
|
private DataSetTableService dataSetTableService;
|
||||||
@Resource
|
@Resource
|
||||||
private ExtDataSetGroupMapper extDataSetGroupMapper;
|
private ExtDataSetGroupMapper extDataSetGroupMapper;
|
||||||
|
@Resource
|
||||||
|
private SysAuthService sysAuthService;
|
||||||
|
|
||||||
public DataSetGroupDTO save(DatasetGroup datasetGroup) {
|
public DataSetGroupDTO save(DatasetGroup datasetGroup) {
|
||||||
checkName(datasetGroup);
|
checkName(datasetGroup);
|
||||||
@ -54,6 +58,10 @@ public class DataSetGroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void delete(String id) throws Exception {
|
public void delete(String id) throws Exception {
|
||||||
|
|
||||||
|
Assert.notNull(id, "id cannot be null");
|
||||||
|
sysAuthService.checkTreeNoManageCount("dataset",id);
|
||||||
|
|
||||||
DatasetGroup dg = datasetGroupMapper.selectByPrimaryKey(id);
|
DatasetGroup dg = datasetGroupMapper.selectByPrimaryKey(id);
|
||||||
DataSetGroupRequest datasetGroup = new DataSetGroupRequest();
|
DataSetGroupRequest datasetGroup = new DataSetGroupRequest();
|
||||||
BeanUtils.copyBean(datasetGroup, dg);
|
BeanUtils.copyBean(datasetGroup, dg);
|
||||||
|
@ -17,6 +17,7 @@ import io.dataease.dto.panel.PanelDesignDTO;
|
|||||||
import io.dataease.dto.panel.PanelGroupDTO;
|
import io.dataease.dto.panel.PanelGroupDTO;
|
||||||
import io.dataease.i18n.Translator;
|
import io.dataease.i18n.Translator;
|
||||||
import io.dataease.service.chart.ChartViewService;
|
import io.dataease.service.chart.ChartViewService;
|
||||||
|
import io.dataease.service.sys.SysAuthService;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -57,6 +58,8 @@ public class PanelGroupService {
|
|||||||
private ShareService shareService;
|
private ShareService shareService;
|
||||||
@Resource
|
@Resource
|
||||||
private PanelLinkService panelLinkService;
|
private PanelLinkService panelLinkService;
|
||||||
|
@Resource
|
||||||
|
private SysAuthService sysAuthService;
|
||||||
|
|
||||||
public List<PanelGroupDTO> tree(PanelGroupRequest panelGroupRequest) {
|
public List<PanelGroupDTO> tree(PanelGroupRequest panelGroupRequest) {
|
||||||
String userId = String.valueOf(AuthUtils.getUser().getUserId());
|
String userId = String.valueOf(AuthUtils.getUser().getUserId());
|
||||||
@ -132,6 +135,7 @@ public class PanelGroupService {
|
|||||||
|
|
||||||
public void deleteCircle(String id) {
|
public void deleteCircle(String id) {
|
||||||
Assert.notNull(id, "id cannot be null");
|
Assert.notNull(id, "id cannot be null");
|
||||||
|
sysAuthService.checkTreeNoManageCount("panel",id);
|
||||||
// 同时会删除对应默认仪表盘
|
// 同时会删除对应默认仪表盘
|
||||||
extPanelGroupMapper.deleteCircle(id);
|
extPanelGroupMapper.deleteCircle(id);
|
||||||
storeService.removeByPanelId(id);
|
storeService.removeByPanelId(id);
|
||||||
|
@ -41,9 +41,11 @@ public class SysAuthService {
|
|||||||
@Resource
|
@Resource
|
||||||
private ExtVAuthModelMapper extVAuthModelMapper;
|
private ExtVAuthModelMapper extVAuthModelMapper;
|
||||||
|
|
||||||
|
|
||||||
private static List<String> PRI_MODEL_TYPE = Arrays.asList("link", "dataset", "chart", "panel", "menu");
|
private static List<String> PRI_MODEL_TYPE = Arrays.asList("link", "dataset", "chart", "panel", "menu");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 查询可见授权数据的数据如果是管理员(IsAdmin = true)且modelType 为link dataset chart panel menu可以查询到所有的数据,
|
* @Description: 查询可见授权数据的数据如果是管理员(IsAdmin = true)且modelType 为link dataset chart panel menu可以查询到所有的数据,
|
||||||
* 如果是普通用户,只能查询到自己的数据;但是 node_type 为spine 时 节点也会返回
|
* 如果是普通用户,只能查询到自己的数据;但是 node_type 为spine 时 节点也会返回
|
||||||
@ -137,5 +139,10 @@ public class SysAuthService {
|
|||||||
return authId;
|
return authId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkTreeNoManageCount(String modelType,String nodeId){
|
||||||
|
if(extSysAuthMapper.checkTreeNoManageCount(AuthUtils.getUser().getUserId(),modelType,nodeId)){
|
||||||
|
throw new RuntimeException(Translator.get("i18n_no_all_delete_privilege_folder"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ INSERT INTO `sys_menu` VALUES (16, 2, 0, 2, '删除用户', NULL, NULL, 999, NUL
|
|||||||
INSERT INTO `sys_menu` VALUES (17, 2, 0, 2, '编辑用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:edit', NULL, NULL, 1614930935529, 1614930935529);
|
INSERT INTO `sys_menu` VALUES (17, 2, 0, 2, '编辑用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:edit', NULL, NULL, 1614930935529, 1614930935529);
|
||||||
INSERT INTO `sys_menu` VALUES (24, 34, 0, 2, '创建连接', NULL, NULL, 997, NULL, NULL, b'0', b'0', b'0', 'datasource:add', NULL, NULL, 1614931168956, 1615783705537);
|
INSERT INTO `sys_menu` VALUES (24, 34, 0, 2, '创建连接', NULL, NULL, 997, NULL, NULL, b'0', b'0', b'0', 'datasource:add', NULL, NULL, 1614931168956, 1615783705537);
|
||||||
|
|
||||||
INSERT INTO `sys_menu` VALUES (27, 34, 0, 2, '校验连接', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'datasource:validate', NULL, NULL, 1614931268578, 1614931268578);
|
|
||||||
INSERT INTO `sys_menu` VALUES (28, 2, 0, 2, '修改密码', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:editPwd', NULL, NULL, 1615275128262, 1615275128262);
|
INSERT INTO `sys_menu` VALUES (28, 2, 0, 2, '修改密码', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:editPwd', NULL, NULL, 1615275128262, 1615275128262);
|
||||||
INSERT INTO `sys_menu` VALUES (30, 0, 0, 1, '仪表板', 'panel', 'panel/index', 1, NULL, '/panel', b'0', b'0', b'0', NULL, NULL, NULL, NULL, 1619081449067);
|
INSERT INTO `sys_menu` VALUES (30, 0, 0, 1, '仪表板', 'panel', 'panel/index', 1, NULL, '/panel', b'0', b'0', b'0', NULL, NULL, NULL, NULL, 1619081449067);
|
||||||
INSERT INTO `sys_menu` VALUES (34, 0, 4, 1, '数据源', 'datasource', 'system/datasource/index', 4, NULL, '/datasource', b'0', b'0', b'0', 'datasource:read', NULL, NULL, NULL, NULL);
|
INSERT INTO `sys_menu` VALUES (34, 0, 4, 1, '数据源', 'datasource', 'system/datasource/index', 4, NULL, '/datasource', b'0', b'0', b'0', 'datasource:read', NULL, NULL, NULL, NULL);
|
||||||
|
@ -64,6 +64,31 @@ CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_auth_model` AS select
|
|||||||
DROP VIEW IF EXISTS `v_auth_privilege`;
|
DROP VIEW IF EXISTS `v_auth_privilege`;
|
||||||
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_auth_privilege` AS select `sys_auth`.`auth_source` AS `auth_source`,`sys_auth`.`auth_source_type` AS `auth_source_type`,group_concat(`sys_auth_detail`.`privilege_extend` separator ',') AS `privileges` from (`sys_auth` left join `sys_auth_detail` on((`sys_auth`.`id` = `sys_auth_detail`.`auth_id`))) where ((`sys_auth_detail`.`privilege_value` = 1) and (((`sys_auth`.`auth_target_type` = 'dept') and (`sys_auth`.`auth_target` = (select `sys_user`.`dept_id` from `sys_user` where (`sys_user`.`user_id` = '4')))) or ((`sys_auth`.`auth_target_type` = 'user') and (`sys_auth`.`auth_target` = '4')) or ((`sys_auth`.`auth_target_type` = 'role') and (`sys_auth`.`auth_target` = (select `sys_users_roles`.`role_id` from `sys_users_roles` where (`sys_users_roles`.`user_id` = '4')))))) group by `sys_auth`.`auth_source`,`sys_auth`.`auth_source_type`;
|
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_auth_privilege` AS select `sys_auth`.`auth_source` AS `auth_source`,`sys_auth`.`auth_source_type` AS `auth_source_type`,group_concat(`sys_auth_detail`.`privilege_extend` separator ',') AS `privileges` from (`sys_auth` left join `sys_auth_detail` on((`sys_auth`.`id` = `sys_auth_detail`.`auth_id`))) where ((`sys_auth_detail`.`privilege_value` = 1) and (((`sys_auth`.`auth_target_type` = 'dept') and (`sys_auth`.`auth_target` = (select `sys_user`.`dept_id` from `sys_user` where (`sys_user`.`user_id` = '4')))) or ((`sys_auth`.`auth_target_type` = 'user') and (`sys_auth`.`auth_target` = '4')) or ((`sys_auth`.`auth_target_type` = 'role') and (`sys_auth`.`auth_target` = (select `sys_users_roles`.`role_id` from `sys_users_roles` where (`sys_users_roles`.`user_id` = '4')))))) group by `sys_auth`.`auth_source`,`sys_auth`.`auth_source_type`;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Function structure for CHECK_TREE_NO_MANAGE_PRIVILEGE
|
||||||
|
-- ----------------------------
|
||||||
|
DROP FUNCTION IF EXISTS `CHECK_TREE_NO_MANAGE_PRIVILEGE`;
|
||||||
|
delimiter ;;
|
||||||
|
CREATE FUNCTION `CHECK_TREE_NO_MANAGE_PRIVILEGE`(userId varchar(255),modelType varchar(255),nodeId varchar(255))
|
||||||
|
RETURNS int(11)
|
||||||
|
READS SQL DATA
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
DECLARE privilegeType INTEGER;
|
||||||
|
DECLARE allTreeIds longtext;
|
||||||
|
DECLARE allPrivilegeTreeIds longtext;
|
||||||
|
DECLARE result INTEGER;
|
||||||
|
|
||||||
|
select privilege_type into privilegeType from sys_auth_detail where auth_id =modelType and privilege_extend ='manage';
|
||||||
|
select GET_V_AUTH_MODEL_WITH_CHILDREN( nodeId ,modelType) into allTreeIds;
|
||||||
|
select GET_V_AUTH_MODEL_WITH_PRIVILEGE(userId,modelType,privilegeType) into allPrivilegeTreeIds;
|
||||||
|
select count(id) into result from v_auth_model where v_auth_model.model_type=modelType and FIND_IN_SET(v_auth_model.id,allTreeIds) and (!FIND_IN_SET(v_auth_model.id,allPrivilegeTreeIds) or ISNULL(allPrivilegeTreeIds));
|
||||||
|
|
||||||
|
RETURN result;
|
||||||
|
END
|
||||||
|
;;
|
||||||
|
delimiter ;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Function structure for copy_auth
|
-- Function structure for copy_auth
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
@ -372,37 +397,10 @@ BEGIN
|
|||||||
|
|
||||||
DECLARE oTempLeafIds longtext;
|
DECLARE oTempLeafIds longtext;
|
||||||
DECLARE oTempAllIds longtext;
|
DECLARE oTempAllIds longtext;
|
||||||
select GROUP_CONCAT(auth_source) into oTempLeafIds from (
|
|
||||||
SELECT
|
|
||||||
sys_auth.auth_source_type,
|
|
||||||
sys_auth.auth_source
|
|
||||||
FROM
|
|
||||||
sys_auth
|
|
||||||
LEFT JOIN sys_auth_detail ON sys_auth.id = sys_auth_detail.auth_id
|
|
||||||
WHERE
|
|
||||||
sys_auth_detail.privilege_type = 1
|
|
||||||
and sys_auth.auth_source_type = modelType
|
|
||||||
AND (
|
|
||||||
(
|
|
||||||
sys_auth.auth_target_type = 'dept'
|
|
||||||
AND sys_auth.auth_target in ( SELECT dept_id FROM sys_user WHERE user_id = userId )
|
|
||||||
)
|
|
||||||
OR (
|
|
||||||
sys_auth.auth_target_type = 'user'
|
|
||||||
AND sys_auth.auth_target = userId
|
|
||||||
)
|
|
||||||
OR (
|
|
||||||
sys_auth.auth_target_type = 'role'
|
|
||||||
AND sys_auth.auth_target in ( SELECT role_id FROM sys_users_roles WHERE user_id = userId )
|
|
||||||
)
|
|
||||||
OR (1 = ( SELECT is_admin FROM sys_user WHERE user_id = userId ))
|
|
||||||
)
|
|
||||||
GROUP BY
|
|
||||||
sys_auth.auth_source_type,
|
|
||||||
sys_auth.auth_source
|
|
||||||
having (sum( sys_auth_detail.privilege_value )> 0 or 1 = ( SELECT is_admin FROM sys_user WHERE user_id = userId ))) temp;
|
|
||||||
|
|
||||||
select GROUP_CONCAT(id) into oTempAllIds from (select GET_V_AUTH_MODEL_WITH_PARENT ( oTempLeafIds ,modelType) cids) t, v_auth_model where v_auth_model.model_type=modelType and FIND_IN_SET(v_auth_model.id,cids);
|
select GET_V_AUTH_MODEL_WITH_PRIVILEGE(userId,modelType,1) into oTempLeafIds;
|
||||||
|
|
||||||
|
select GROUP_CONCAT(id) into oTempAllIds from (select GET_V_AUTH_MODEL_WITH_PARENT ( oTempLeafIds ,modelType) cids) t, v_auth_model where v_auth_model.model_type=modelType and FIND_IN_SET(v_auth_model.id,cids) order by id asc;
|
||||||
|
|
||||||
RETURN oTempAllIds;
|
RETURN oTempAllIds;
|
||||||
END
|
END
|
||||||
@ -433,7 +431,7 @@ DO
|
|||||||
|
|
||||||
SET oTemp = CONCAT(oTemp,',',oTempChild);
|
SET oTemp = CONCAT(oTemp,',',oTempChild);
|
||||||
|
|
||||||
SELECT GROUP_CONCAT(id) INTO oTempChild FROM V_AUTH_MODEL WHERE FIND_IN_SET(pid,oTempChild) > 0 and V_AUTH_MODEL.model_type=modelType;
|
SELECT GROUP_CONCAT(id) INTO oTempChild FROM V_AUTH_MODEL WHERE FIND_IN_SET(pid,oTempChild) > 0 and V_AUTH_MODEL.model_type=modelType order by id asc;
|
||||||
|
|
||||||
END WHILE;
|
END WHILE;
|
||||||
|
|
||||||
@ -467,7 +465,7 @@ DO
|
|||||||
|
|
||||||
SET oTemp = CONCAT(oTemp,',',oTempParent);
|
SET oTemp = CONCAT(oTemp,',',oTempParent);
|
||||||
|
|
||||||
SELECT GROUP_CONCAT(pid) INTO oTempParent FROM V_AUTH_MODEL WHERE FIND_IN_SET(id,oTempParent) > 0 and V_AUTH_MODEL.model_type=modelType;
|
SELECT GROUP_CONCAT(distinct pid) INTO oTempParent FROM V_AUTH_MODEL WHERE FIND_IN_SET(id,oTempParent) > 0 and V_AUTH_MODEL.model_type=modelType order by pid asc;
|
||||||
|
|
||||||
END WHILE;
|
END WHILE;
|
||||||
|
|
||||||
@ -477,6 +475,52 @@ END
|
|||||||
;;
|
;;
|
||||||
delimiter ;
|
delimiter ;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Function structure for GET_V_AUTH_MODEL_WITH_PRIVILEGE
|
||||||
|
-- ----------------------------
|
||||||
|
DROP FUNCTION IF EXISTS `GET_V_AUTH_MODEL_WITH_PRIVILEGE`;
|
||||||
|
delimiter ;;
|
||||||
|
CREATE FUNCTION `GET_V_AUTH_MODEL_WITH_PRIVILEGE`(userId longtext,modelType varchar(255),privilegeType varchar(255))
|
||||||
|
RETURNS longtext CHARSET utf8
|
||||||
|
READS SQL DATA
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
DECLARE oTempLeafIds longtext;
|
||||||
|
select GROUP_CONCAT(auth_source) into oTempLeafIds from (
|
||||||
|
SELECT
|
||||||
|
sys_auth.auth_source_type,
|
||||||
|
sys_auth.auth_source
|
||||||
|
FROM
|
||||||
|
sys_auth
|
||||||
|
LEFT JOIN sys_auth_detail ON sys_auth.id = sys_auth_detail.auth_id
|
||||||
|
WHERE
|
||||||
|
sys_auth_detail.privilege_type = privilegeType
|
||||||
|
and sys_auth.auth_source_type = modelType
|
||||||
|
AND (
|
||||||
|
(
|
||||||
|
sys_auth.auth_target_type = 'dept'
|
||||||
|
AND sys_auth.auth_target in ( SELECT dept_id FROM sys_user WHERE user_id = userId )
|
||||||
|
)
|
||||||
|
OR (
|
||||||
|
sys_auth.auth_target_type = 'user'
|
||||||
|
AND sys_auth.auth_target = userId
|
||||||
|
)
|
||||||
|
OR (
|
||||||
|
sys_auth.auth_target_type = 'role'
|
||||||
|
AND sys_auth.auth_target in ( SELECT role_id FROM sys_users_roles WHERE user_id = userId )
|
||||||
|
)
|
||||||
|
OR (1 = ( SELECT is_admin FROM sys_user WHERE user_id = userId ))
|
||||||
|
)
|
||||||
|
GROUP BY
|
||||||
|
sys_auth.auth_source_type,
|
||||||
|
sys_auth.auth_source
|
||||||
|
having (sum( sys_auth_detail.privilege_value )> 0 or 1 = ( SELECT is_admin FROM sys_user WHERE user_id = userId ))) temp;
|
||||||
|
RETURN oTempLeafIds;
|
||||||
|
END
|
||||||
|
;;
|
||||||
|
delimiter ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DROP TRIGGER if exists`new_auth_link`;
|
DROP TRIGGER if exists`new_auth_link`;
|
||||||
|
@ -258,4 +258,5 @@ i18n_excel_header_empty=Excel first row can not empty
|
|||||||
i18n_custom_ds_delete=Custom dataset union data is deleted,can not display
|
i18n_custom_ds_delete=Custom dataset union data is deleted,can not display
|
||||||
i18n_sql_add_not_matching=The data column of incremental SQL does not match the dataset,
|
i18n_sql_add_not_matching=The data column of incremental SQL does not match the dataset,
|
||||||
i18n_sql_delete_not_matching=The data column of incremental delete SQL does not match the dataset,
|
i18n_sql_delete_not_matching=The data column of incremental delete SQL does not match the dataset,
|
||||||
i18n_cst_ds_tb_or_field_deleted=Custom dataset union data is deleted or field changed,can not display
|
i18n_cst_ds_tb_or_field_deleted=Custom dataset union data is deleted or field changed,can not display
|
||||||
|
i18n_no_all_delete_privilege_folder=This folder have sources which have no manage or view privilege,Can Not Be Deleted.
|
||||||
|
@ -258,4 +258,4 @@ i18n_custom_ds_delete=自定义数据集所关联数据被删除,无法正常
|
|||||||
i18n_sql_add_not_matching=增量添加 sql 的数据列与数据集不匹配,
|
i18n_sql_add_not_matching=增量添加 sql 的数据列与数据集不匹配,
|
||||||
i18n_sql_delete_not_matching=增量删除 sql 的数据列与数据集不匹配,
|
i18n_sql_delete_not_matching=增量删除 sql 的数据列与数据集不匹配,
|
||||||
i18n_cst_ds_tb_or_field_deleted=自定义数据集所关联数据被删除或字段发生变化,无法正常显示
|
i18n_cst_ds_tb_or_field_deleted=自定义数据集所关联数据被删除或字段发生变化,无法正常显示
|
||||||
|
i18n_no_all_delete_privilege_folder=该目录下存在没有管理权限或查看权限的资源,无法删除
|
||||||
|
@ -260,4 +260,5 @@ i18n_excel_header_empty=Excel第一行為空
|
|||||||
i18n_custom_ds_delete=自定義數據集所關聯數據被刪除,無法正常顯示
|
i18n_custom_ds_delete=自定義數據集所關聯數據被刪除,無法正常顯示
|
||||||
i18n_sql_add_not_matching=增量添加 sql 的數據列與數據集不匹配,
|
i18n_sql_add_not_matching=增量添加 sql 的數據列與數據集不匹配,
|
||||||
i18n_sql_delete_not_matching=增量刪除 sql 的數據列與數據集不匹配,
|
i18n_sql_delete_not_matching=增量刪除 sql 的數據列與數據集不匹配,
|
||||||
i18n_cst_ds_tb_or_field_deleted=自定義數據集所關聯數據被刪除或字段發生變化,無法正常顯示
|
i18n_cst_ds_tb_or_field_deleted=自定義數據集所關聯數據被刪除或字段發生變化,無法正常顯示
|
||||||
|
i18n_no_all_delete_privilege_folder=该目录下存在没有管理权限或查看权限的资源,无法删除
|
||||||
|
@ -23,6 +23,7 @@ export default {
|
|||||||
@import "~@/styles/variables.scss";
|
@import "~@/styles/variables.scss";
|
||||||
|
|
||||||
.app-main {
|
.app-main {
|
||||||
|
height: 100%;
|
||||||
/* topbar 56 */
|
/* topbar 56 */
|
||||||
// min-height: calc(100vh - 56px);
|
// min-height: calc(100vh - 56px);
|
||||||
// width: 100%;
|
// width: 100%;
|
||||||
|
@ -899,7 +899,7 @@ export default {
|
|||||||
authModel(queryCondition).then(res => {
|
authModel(queryCondition).then(res => {
|
||||||
// this.highlights(res.data)
|
// this.highlights(res.data)
|
||||||
this.tData = this.buildTree(res.data)
|
this.tData = this.buildTree(res.data)
|
||||||
console.log(this.tData)
|
// console.log(this.tData)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ export default {
|
|||||||
post('/dataset/table/incrementalConfig', { tableId: this.table.id }).then(response => {
|
post('/dataset/table/incrementalConfig', { tableId: this.table.id }).then(response => {
|
||||||
this.incrementalConfig = response.data
|
this.incrementalConfig = response.data
|
||||||
this.incrementalUpdateType = 'incrementalAdd'
|
this.incrementalUpdateType = 'incrementalAdd'
|
||||||
console.log(this.sql)
|
// console.log(this.sql)
|
||||||
if (this.incrementalConfig.incrementalAdd) {
|
if (this.incrementalConfig.incrementalAdd) {
|
||||||
this.sql = this.incrementalConfig.incrementalAdd
|
this.sql = this.incrementalConfig.incrementalAdd
|
||||||
} else {
|
} else {
|
||||||
|
@ -857,7 +857,7 @@ export default {
|
|||||||
authModel(queryCondition).then(res => {
|
authModel(queryCondition).then(res => {
|
||||||
// this.highlights(res.data)
|
// this.highlights(res.data)
|
||||||
this.tData = this.buildTree(res.data)
|
this.tData = this.buildTree(res.data)
|
||||||
console.log(this.tData)
|
// console.log(this.tData)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -60,8 +60,7 @@ export default {
|
|||||||
activeNames: ['panel'],
|
activeNames: ['panel'],
|
||||||
chart: null,
|
chart: null,
|
||||||
tableChart: null,
|
tableChart: null,
|
||||||
collapseShow: true,
|
collapseShow: true
|
||||||
tableChartShow: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: mapState([
|
computed: mapState([
|
||||||
@ -74,7 +73,10 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
bus.$on('onSubjectChange', () => {
|
bus.$on('onSubjectChange', () => {
|
||||||
this.collapseShow = false
|
this.collapseShow = false
|
||||||
this.$nextTick(() => (this.collapseShow = true))
|
this.$nextTick(() => {
|
||||||
|
this.init()
|
||||||
|
this.collapseShow = true
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -100,8 +102,6 @@ export default {
|
|||||||
// 因为 table 的color 设置和view的共用 所以单独设置一个对象
|
// 因为 table 的color 设置和view的共用 所以单独设置一个对象
|
||||||
this.tableChart = deepCopy(this.chart)
|
this.tableChart = deepCopy(this.chart)
|
||||||
this.tableChart.customAttr.color = this.tableChart.customAttr.tableColor
|
this.tableChart.customAttr.color = this.tableChart.customAttr.tableColor
|
||||||
this.tableChartShow = false
|
|
||||||
this.$nextTick(() => (this.tableChartShow = true))
|
|
||||||
},
|
},
|
||||||
handleChange(val) {
|
handleChange(val) {
|
||||||
// console.log(val)
|
// console.log(val)
|
||||||
|
@ -84,7 +84,8 @@ export default {
|
|||||||
currentTemplateType: 'system',
|
currentTemplateType: 'system',
|
||||||
templateEditFormRules: {
|
templateEditFormRules: {
|
||||||
name: [
|
name: [
|
||||||
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' }
|
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' },
|
||||||
|
{ max: 50, message: this.$t('commons.char_can_not_more_50'), trigger: 'change' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
templateEditForm: {},
|
templateEditForm: {},
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<span class="title-text">
|
<span class="title-text">
|
||||||
{{ $t('commons.datasource') }}
|
{{ $t('commons.datasource') }}
|
||||||
</span>
|
</span>
|
||||||
<el-button icon="el-icon-plus" type="text" size="mini" style="float: right;" @click="addFolder" />
|
<el-button v-permission="['datasource:add']" icon="el-icon-plus" type="text" size="mini" style="float: right;" @click="addFolder" />
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-divider />
|
<el-divider />
|
||||||
@ -47,18 +47,19 @@
|
|||||||
</span>
|
</span>
|
||||||
<span class="child">
|
<span class="child">
|
||||||
<span v-if="data.type ==='folder'" @click.stop>
|
<span v-if="data.type ==='folder'" @click.stop>
|
||||||
<span class="el-dropdown-link">
|
<!-- <span class="el-dropdown-link">
|
||||||
<el-button
|
<el-button
|
||||||
|
v-permission="['datasource:add']"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
type="text"
|
type="text"
|
||||||
size="small"
|
size="small"
|
||||||
@click="addFolderWithType(data)"
|
@click="addFolderWithType(data)"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span> -->
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
<span v-if="data.type !=='folder'" style="margin-left: 12px;" @click.stop>
|
<span v-if="data.type !=='folder'" style="margin-left: 12px;" @click.stop>
|
||||||
<span class="el-dropdown-link">
|
<span v-if="hasDataPermission('manage',data.privileges)" class="el-dropdown-link">
|
||||||
<el-button
|
<el-button
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
type="text"
|
type="text"
|
||||||
@ -95,6 +96,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { listDatasource, delDs } from '@/api/system/datasource'
|
import { listDatasource, delDs } from '@/api/system/datasource'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DsTree',
|
name: 'DsTree',
|
||||||
data() {
|
data() {
|
||||||
@ -112,6 +114,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.queryTreeDatas()
|
this.queryTreeDatas()
|
||||||
|
console.log('permis:' + JSON.stringify(this.$store.getters.permissions))
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
filterNode(value, data) {
|
filterNode(value, data) {
|
||||||
|
@ -52,12 +52,12 @@
|
|||||||
</el-form-item> -->
|
</el-form-item> -->
|
||||||
</el-form>
|
</el-form>
|
||||||
<div v-if="canEdit" slot="footer" class="dialog-footer">
|
<div v-if="canEdit" slot="footer" class="dialog-footer">
|
||||||
<el-button @click="validaDatasource">{{ $t('commons.validate') }}</el-button>
|
<el-button v-if="formType==='add'?true: hasDataPermission('manage',params.privileges)" @click="validaDatasource">{{ $t('commons.validate') }}</el-button>
|
||||||
<el-button type="primary" @click="save">{{ $t('commons.save') }}</el-button>
|
<el-button v-if="formType==='add'?true: hasDataPermission('manage',params.privileges)" type="primary" @click="save">{{ $t('commons.save') }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div v-else slot="footer" class="dialog-footer">
|
<div v-else slot="footer" class="dialog-footer">
|
||||||
<el-button @click="validaDatasource">{{ $t('commons.validate') }}</el-button>
|
<el-button v-if="formType==='add'?true: hasDataPermission('manage',params.privileges)" @click="validaDatasource">{{ $t('commons.validate') }}</el-button>
|
||||||
<el-button type="primary" @click="changeEdit">{{ $t('commons.edit') }}</el-button>
|
<el-button v-if="formType==='add'?true: hasDataPermission('manage',params.privileges)" type="primary" @click="changeEdit">{{ $t('commons.edit') }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</layout-content>
|
</layout-content>
|
||||||
|
@ -20,19 +20,19 @@
|
|||||||
<el-input v-model="form.confirmPassword" autocomplete="off" show-password />
|
<el-input v-model="form.confirmPassword" autocomplete="off" show-password />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="$t('commons.gender')">
|
<el-form-item :label="$t('commons.gender')" prop="gender">
|
||||||
<el-radio-group v-model="form.gender" style="width: 178px">
|
<el-radio-group v-model="form.gender" style="width: 178px">
|
||||||
<el-radio :label="$t('commons.man')">{{ $t('commons.man') }}</el-radio>
|
<el-radio :label="$t('commons.man')">{{ $t('commons.man') }}</el-radio>
|
||||||
<el-radio :label="$t('commons.woman')">{{ $t('commons.woman') }}</el-radio>
|
<el-radio :label="$t('commons.woman')">{{ $t('commons.woman') }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('commons.status')">
|
<el-form-item :label="$t('commons.status')" prop="enabled">
|
||||||
<el-radio-group v-model="form.enabled" :disabled="formType !== 'add' && form.isAdmin" style="width: 140px">
|
<el-radio-group v-model="form.enabled" :disabled="formType !== 'add' && form.isAdmin" style="width: 140px">
|
||||||
<el-radio :label="1">{{ $t('commons.enable') }}</el-radio>
|
<el-radio :label="1">{{ $t('commons.enable') }}</el-radio>
|
||||||
<el-radio :label="0">{{ $t('commons.disable') }}</el-radio>
|
<el-radio :label="0">{{ $t('commons.disable') }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('commons.organization')" prop="dept">
|
<el-form-item :label="$t('commons.organization')" prop="deptId">
|
||||||
<treeselect
|
<treeselect
|
||||||
ref="deptTreeSelect"
|
ref="deptTreeSelect"
|
||||||
v-model="form.deptId"
|
v-model="form.deptId"
|
||||||
@ -148,7 +148,10 @@ export default {
|
|||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
roleIds: [{ required: true, message: this.$t('user.input_roles'), trigger: 'change' }]
|
roleIds: [{ required: true, message: this.$t('user.input_roles'), trigger: 'change' }],
|
||||||
|
deptId: [],
|
||||||
|
gender: [],
|
||||||
|
enable: []
|
||||||
|
|
||||||
},
|
},
|
||||||
defaultForm: { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 1, deptId: null, phone: null, roleIds: [2] },
|
defaultForm: { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 1, deptId: null, phone: null, roleIds: [2] },
|
||||||
@ -285,6 +288,7 @@ export default {
|
|||||||
save() {
|
save() {
|
||||||
this.$refs.createUserForm.validate(valid => {
|
this.$refs.createUserForm.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
!this.form.deptId && (this.form.deptId = 0)
|
||||||
const method = this.formType === 'add' ? addUser : editUser
|
const method = this.formType === 'add' ? addUser : editUser
|
||||||
method(this.form).then(res => {
|
method(this.form).then(res => {
|
||||||
this.$success(this.$t('commons.save_success'))
|
this.$success(this.$t('commons.save_success'))
|
||||||
|
Loading…
Reference in New Issue
Block a user