Merge branch 'main' of github.com:dataease/dataease into main

This commit is contained in:
taojinlong 2021-05-24 18:45:11 +08:00
commit ead3efcef9
2 changed files with 7 additions and 40 deletions

View File

@ -38,38 +38,8 @@
create_time,
panel_type,
`name` AS label,
authInfo.`privileges`
get_auths(id,'panel',#{userId}) as `privileges`
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'panel') cids) t,panel_group
left join
(SELECT
`sys_auth`.`auth_source` AS `auth_source`,
`sys_auth`.`auth_source_type` AS `auth_source_type`,
group_concat( sys_auth_detail.privilege_extend) 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 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 = ( SELECT role_id FROM sys_users_roles WHERE user_id = #{userId} )
)
)
GROUP BY
`sys_auth`.`auth_source`,
`sys_auth`.`auth_source_type`) authInfo
on panel_group.id = authInfo.auth_source and authInfo.auth_source_type='panel'
<where>
FIND_IN_SET(panel_group.id,cids)
<if test="name != null">

View File

@ -191,9 +191,8 @@ delimiter ;
-- ----------------------------
DROP FUNCTION IF EXISTS `get_auths`;
delimiter ;;
CREATE FUNCTION `get_auths`(authSource varchar(255),modelType varchar(255),userId varchar(255))
RETURNS longtext CHARSET utf8
READS SQL DATA
CREATE DEFINER=`root`@`%` FUNCTION `get_auths`(authSource varchar(255),modelType varchar(255),userId varchar(255)) RETURNS longtext CHARSET utf8
READS SQL DATA
BEGIN
DECLARE oTemp longtext;
@ -211,7 +210,7 @@ FROM
AND (
(
sys_auth.auth_target_type = 'dept'
AND sys_auth.auth_target = ( SELECT dept_id FROM sys_user WHERE user_id = userId )
AND sys_auth.auth_target in ( SELECT dept_id FROM sys_user WHERE user_id = userId )
)
OR (
sys_auth.auth_target_type = 'user'
@ -219,7 +218,7 @@ FROM
)
OR (
sys_auth.auth_target_type = 'role'
AND sys_auth.auth_target = ( SELECT role_id FROM sys_users_roles WHERE user_id = userId )
AND sys_auth.auth_target in ( SELECT role_id FROM sys_users_roles WHERE user_id = userId )
)
)
GROUP BY
@ -303,8 +302,6 @@ delimiter ;
-- ----------------------------
-- Function structure for GET_V_AUTH_MODEL_ID_P_USE
-- ----------------------------
DROP FUNCTION IF EXISTS `GET_V_AUTH_MODEL_ID_P_USE`;
delimiter ;;
CREATE DEFINER=`root`@`%` FUNCTION `GET_V_AUTH_MODEL_ID_P_USE`(userId longtext,modelType varchar(255)) RETURNS longtext CHARSET utf8
READS SQL DATA
BEGIN
@ -324,7 +321,7 @@ SELECT
AND (
(
sys_auth.auth_target_type = 'dept'
AND sys_auth.auth_target = ( SELECT dept_id FROM sys_user WHERE user_id = userId )
AND sys_auth.auth_target in ( SELECT dept_id FROM sys_user WHERE user_id = userId )
)
OR (
sys_auth.auth_target_type = 'user'
@ -332,7 +329,7 @@ SELECT
)
OR (
sys_auth.auth_target_type = 'role'
AND sys_auth.auth_target = ( SELECT role_id FROM sys_users_roles WHERE user_id = userId )
AND sys_auth.auth_target in ( SELECT role_id FROM sys_users_roles WHERE user_id = userId )
)
)
GROUP BY