forked from github/dataease
Merge pull request #4724 from dataease/refactor_public-detail-export
refactor(仪表板): 公共链接视图明细导出权限优化,导出权限跟随分享人 #4649
This commit is contained in:
commit
2d43fbb695
@ -54,8 +54,8 @@ public interface LinkApi {
|
||||
boolean validatePwd(PasswordRequest request) throws Exception;
|
||||
|
||||
@ApiOperation("资源详细信息")
|
||||
@GetMapping("/resourceDetail/{resourceId}")
|
||||
Object resourceDetail(@PathVariable String resourceId);
|
||||
@GetMapping("/resourceDetail/{resourceId}/{userId}")
|
||||
Object resourceDetail(@PathVariable String resourceId,@PathVariable String userId);
|
||||
|
||||
@ApiOperation("视图详细信息")
|
||||
@PostMapping("/viewDetail/{viewId}/{panelId}")
|
||||
|
@ -94,8 +94,8 @@ public class LinkServer implements LinkApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resourceDetail(@PathVariable String resourceId) {
|
||||
return panelLinkService.resourceInfo(resourceId);
|
||||
public Object resourceDetail(@PathVariable String resourceId,@PathVariable String userId) {
|
||||
return panelLinkService.resourceInfo(resourceId,userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -125,7 +125,7 @@ public class LinkServer implements LinkApi {
|
||||
operateType = SysLogConstants.OPERATE_TYPE.MB_VIEW;
|
||||
}
|
||||
if (ObjectUtils.isEmpty(userId)) return;
|
||||
PanelGroupWithBLOBs panelGroupWithBLOBs = panelLinkService.resourceInfo(panelId);
|
||||
PanelGroupWithBLOBs panelGroupWithBLOBs = panelLinkService.resourceInfo(panelId,String.valueOf(userId));
|
||||
String pid = panelGroupWithBLOBs.getPid();
|
||||
DeLogUtils.save(operateType, SysLogConstants.SOURCE_TYPE.LINK, panelId, pid, userId, SysLogConstants.SOURCE_TYPE.USER);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import io.dataease.controller.request.panel.link.OverTimeRequest;
|
||||
import io.dataease.controller.request.panel.link.PasswordRequest;
|
||||
import io.dataease.dto.panel.PanelGroupDTO;
|
||||
import io.dataease.dto.panel.link.GenerateDto;
|
||||
import io.dataease.ext.ExtPanelGroupMapper;
|
||||
import io.dataease.ext.ExtPanelLinkMapper;
|
||||
import io.dataease.plugins.common.base.domain.*;
|
||||
import io.dataease.plugins.common.base.mapper.PanelGroupMapper;
|
||||
@ -49,6 +50,8 @@ public class PanelLinkService {
|
||||
private PanelLinkMappingMapper panelLinkMappingMapper;
|
||||
@Resource
|
||||
private PanelWatermarkMapper panelWatermarkMapper;
|
||||
@Resource
|
||||
private ExtPanelGroupMapper extPanelGroupMapper;
|
||||
|
||||
@Transactional
|
||||
public void changeValid(LinkRequest request) {
|
||||
@ -234,12 +237,10 @@ public class PanelLinkService {
|
||||
return pass;
|
||||
}
|
||||
|
||||
public PanelGroupDTO resourceInfo(String resourceId) {
|
||||
PanelGroupWithBLOBs result = panelGroupMapper.selectByPrimaryKey(resourceId);
|
||||
PanelGroupDTO panelGroupDTO = new PanelGroupDTO();
|
||||
BeanUtils.copyBean(panelGroupDTO, result);
|
||||
panelGroupDTO.setWatermarkInfo(panelWatermarkMapper.selectByPrimaryKey("system_default"));
|
||||
return panelGroupDTO;
|
||||
public PanelGroupDTO resourceInfo(String resourceId,String userId) {
|
||||
PanelGroupDTO result = extPanelGroupMapper.findOneWithPrivileges(resourceId,userId);
|
||||
result.setWatermarkInfo(panelWatermarkMapper.selectByPrimaryKey("system_default"));
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getShortUrl(String resourceId) {
|
||||
|
@ -2,3 +2,54 @@ UPDATE `my_plugin`
|
||||
SET `version` = '1.18.5'
|
||||
where `plugin_id` > 0
|
||||
and `version` = '1.18.4';
|
||||
|
||||
|
||||
DROP FUNCTION IF EXISTS `get_auths`;
|
||||
delimiter ;;
|
||||
CREATE FUNCTION `get_auths`(authSource varchar(255),modelType varchar(255),userId varchar(255))
|
||||
RETURNS longtext CHARSET utf8mb4
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
|
||||
DECLARE oTemp longtext;
|
||||
|
||||
DECLARE isAdmin int;
|
||||
|
||||
select sys_user.is_admin INTO isAdmin from sys_user where user_id =userId;
|
||||
IF isAdmin = 1 THEN
|
||||
return 'ignore';
|
||||
ELSE
|
||||
SELECT
|
||||
group_concat( DISTINCT sys_auth_detail.privilege_extend) into oTemp
|
||||
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_source=authSource
|
||||
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 )
|
||||
)
|
||||
)
|
||||
GROUP BY
|
||||
`sys_auth`.`auth_source`,
|
||||
`sys_auth`.`auth_source_type`;
|
||||
RETURN oTemp;
|
||||
|
||||
END if;
|
||||
|
||||
END
|
||||
;;
|
||||
delimiter ;
|
@ -66,9 +66,9 @@ export function loadGenerate(resourceId) {
|
||||
})
|
||||
}
|
||||
|
||||
export function loadResource(resourceId) {
|
||||
export function loadResource(resourceId,userId) {
|
||||
return request({
|
||||
url: 'api/link/resourceDetail/' + resourceId,
|
||||
url: 'api/link/resourceDetail/' + resourceId+'/'+ userId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ Vue.use(VueVideoPlayer)
|
||||
Vue.use(proportion)
|
||||
|
||||
Vue.prototype.hasDataPermission = function(pTarget, pSource) {
|
||||
if (this.$store.state.user.user.isAdmin) {
|
||||
if (this.$store.state.user.user.isAdmin || pSource === 'ignore') {
|
||||
return true
|
||||
}
|
||||
if (pSource && pTarget) {
|
||||
|
@ -9,7 +9,7 @@ export function checkPermission(pers) {
|
||||
}
|
||||
|
||||
export function hasDataPermission(pTarget, pSource) {
|
||||
if (store.state.user.user.isAdmin) {
|
||||
if (store.state.user.user.isAdmin || pSource === 'ignore') {
|
||||
return true
|
||||
}
|
||||
if (pSource && pTarget) {
|
||||
|
@ -77,7 +77,7 @@ export default {
|
||||
})
|
||||
},
|
||||
setPanelInfo() {
|
||||
loadResource(this.resourceId).then(res => {
|
||||
loadResource(this.resourceId,this.user).then(res => {
|
||||
this.show = false
|
||||
let loadingCount = 0
|
||||
const watermarkInfo = {
|
||||
|
Loading…
Reference in New Issue
Block a user