Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
613df9af
Unverified
提交
613df9af
authored
3月 27, 2022
作者:
王嘉豪
提交者:
GitHub
3月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1970 from dataease/pr@dev@refactor_outer-params
feat: 新增资源默认权限继承
上级
c71de1a5
dbc215f2
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
180 行增加
和
3 行删除
+180
-3
DataSetGroupService.java
...java/io/dataease/service/dataset/DataSetGroupService.java
+4
-0
DataSetTableService.java
...java/io/dataease/service/dataset/DataSetTableService.java
+5
-0
PanelGroupService.java
...ain/java/io/dataease/service/panel/PanelGroupService.java
+12
-3
V33__1.9.sql
backend/src/main/resources/db/migration/V33__1.9.sql
+159
-0
没有找到文件。
backend/src/main/java/io/dataease/service/dataset/DataSetGroupService.java
浏览文件 @
613df9af
...
...
@@ -5,6 +5,7 @@ import io.dataease.base.domain.DatasetGroup;
import
io.dataease.base.domain.DatasetGroupExample
;
import
io.dataease.base.mapper.DatasetGroupMapper
;
import
io.dataease.base.mapper.ext.ExtDataSetGroupMapper
;
import
io.dataease.commons.constants.AuthConstants
;
import
io.dataease.commons.constants.DePermissionType
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.commons.utils.BeanUtils
;
...
...
@@ -14,6 +15,7 @@ import io.dataease.controller.request.dataset.DataSetTableRequest;
import
io.dataease.dto.dataset.DataSetGroupDTO
;
import
io.dataease.dto.dataset.DataSetTableDTO
;
import
io.dataease.i18n.Translator
;
import
io.dataease.listener.util.CacheUtils
;
import
io.dataease.service.sys.SysAuthService
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
...
...
@@ -49,6 +51,8 @@ public class DataSetGroupService {
datasetGroup
.
setCreateBy
(
AuthUtils
.
getUser
().
getUsername
());
datasetGroup
.
setCreateTime
(
System
.
currentTimeMillis
());
datasetGroupMapper
.
insert
(
datasetGroup
);
// 清理权限缓存
CacheUtils
.
removeAll
(
AuthConstants
.
USER_PERMISSION_CACHE_NAME
);
}
else
{
datasetGroupMapper
.
updateByPrimaryKeySelective
(
datasetGroup
);
}
...
...
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
浏览文件 @
613df9af
...
...
@@ -24,6 +24,7 @@ import io.dataease.dto.dataset.union.UnionParamDTO;
import
io.dataease.dto.datasource.TableField
;
import
io.dataease.exception.DataEaseException
;
import
io.dataease.i18n.Translator
;
import
io.dataease.listener.util.CacheUtils
;
import
io.dataease.plugins.common.constants.DatasourceTypes
;
import
io.dataease.plugins.loader.ClassloaderResponsity
;
import
io.dataease.provider.ProviderFactory
;
...
...
@@ -115,6 +116,10 @@ public class DataSetTableService {
public
void
batchInsert
(
List
<
DataSetTableRequest
>
datasetTable
)
throws
Exception
{
for
(
DataSetTableRequest
table
:
datasetTable
)
{
save
(
table
);
// 清理权限缓存
CacheUtils
.
removeAll
(
AuthConstants
.
USER_DATASET_NAME
);
CacheUtils
.
removeAll
(
AuthConstants
.
ROLE_DATASET_NAME
);
CacheUtils
.
removeAll
(
AuthConstants
.
DEPT_DATASET_NAME
);
}
}
...
...
backend/src/main/java/io/dataease/service/panel/PanelGroupService.java
浏览文件 @
613df9af
...
...
@@ -6,6 +6,7 @@ import io.dataease.auth.annotation.DeCleaner;
import
io.dataease.base.domain.*
;
import
io.dataease.base.mapper.*
;
import
io.dataease.base.mapper.ext.*
;
import
io.dataease.commons.constants.AuthConstants
;
import
io.dataease.commons.constants.CommonConstants
;
import
io.dataease.commons.constants.DePermissionType
;
import
io.dataease.commons.constants.PanelConstants
;
...
...
@@ -24,6 +25,7 @@ import io.dataease.dto.panel.linkJump.PanelLinkJumpBaseRequest;
import
io.dataease.dto.panel.po.PanelViewInsertDTO
;
import
io.dataease.exception.DataEaseException
;
import
io.dataease.i18n.Translator
;
import
io.dataease.listener.util.CacheUtils
;
import
io.dataease.service.chart.ChartViewService
;
import
io.dataease.service.dataset.DataSetTableService
;
import
io.dataease.service.sys.SysAuthService
;
...
...
@@ -119,6 +121,8 @@ public class PanelGroupService {
checkPanelName
(
request
.
getName
(),
request
.
getPid
(),
PanelConstants
.
OPT_TYPE_INSERT
,
null
,
request
.
getNodeType
());
panelId
=
newPanel
(
request
);
panelGroupMapper
.
insert
(
request
);
// 清理权限缓存
clearPermissionCache
();
}
else
if
(
"toDefaultPanel"
.
equals
(
request
.
getOptType
()))
{
panelId
=
UUID
.
randomUUID
().
toString
();
// 转存为默认仪表板
...
...
@@ -133,8 +137,12 @@ public class PanelGroupService {
newDefaultPanel
.
setCreateBy
(
AuthUtils
.
getUser
().
getUsername
());
checkPanelName
(
newDefaultPanel
.
getName
(),
newDefaultPanel
.
getPid
(),
PanelConstants
.
OPT_TYPE_INSERT
,
newDefaultPanel
.
getId
(),
newDefaultPanel
.
getNodeType
());
panelGroupMapper
.
insertSelective
(
newDefaultPanel
);
// 清理权限缓存
clearPermissionCache
();
}
else
if
(
"copy"
.
equals
(
request
.
getOptType
()))
{
panelId
=
this
.
panelGroupCopy
(
request
,
null
,
true
);
// 清理权限缓存
clearPermissionCache
();
}
else
if
(
"move"
.
equals
(
request
.
getOptType
()))
{
PanelGroupWithBLOBs
panelInfo
=
panelGroupMapper
.
selectByPrimaryKey
(
request
.
getId
());
if
(
panelInfo
.
getPid
().
equalsIgnoreCase
(
request
.
getPid
()))
{
...
...
@@ -431,9 +439,10 @@ public class PanelGroupService {
}
return
null
;
}
public
void
findPanelAttachInfo
(
String
panelId
)
{
private
void
clearPermissionCache
(){
CacheUtils
.
removeAll
(
AuthConstants
.
USER_PANEL_NAME
);
CacheUtils
.
removeAll
(
AuthConstants
.
ROLE_PANEL_NAME
);
CacheUtils
.
removeAll
(
AuthConstants
.
DEPT_PANEL_NAME
);
}
...
...
backend/src/main/resources/db/migration/V33__1.9.sql
浏览文件 @
613df9af
...
...
@@ -89,4 +89,162 @@ INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUE
UPDATE
`demo_gdp_district_top100`
set
`province`
=
'新疆维吾尔自治区'
WHERE
`province`
=
'新疆维吾尔族自治区'
;
ALTER
TABLE
`sys_auth`
ADD
COLUMN
`copy_from`
varchar
(
255
)
NULL
COMMENT
'复制来源'
AFTER
`update_time`
,
ADD
COLUMN
`copy_id`
varchar
(
255
)
NULL
COMMENT
'复制ID'
AFTER
`copy_from`
;
ALTER
TABLE
`sys_auth_detail`
ADD
COLUMN
`copy_from`
varchar
(
255
)
NULL
COMMENT
'复制来源'
AFTER
`update_time`
,
ADD
COLUMN
`copy_id`
varchar
(
255
)
NULL
COMMENT
'复制ID'
AFTER
`copy_from`
;
-- ----------------------------
-- Function structure for copy_auth
-- ----------------------------
DROP
FUNCTION
IF
EXISTS
`copy_auth`
;
delimiter
;;
CREATE
FUNCTION
`copy_auth`
(
authSource
varchar
(
255
),
authSourceType
varchar
(
255
),
authUser
varchar
(
255
))
RETURNS
varchar
(
255
)
CHARSET
utf8mb4
READS
SQL
DATA
BEGIN
DECLARE
authId
varchar
(
255
);
DECLARE
userId
varchar
(
255
);
DECLARE
copyId
varchar
(
255
);
select
uuid
()
into
authId
;
select
uuid
()
into
copyId
;
select
max
(
sys_user
.
user_id
)
into
userId
from
sys_user
where
username
=
authUser
;
delete
from
sys_auth_detail
where
auth_id
in
(
select
id
from
sys_auth
where
sys_auth
.
auth_source
=
authSource
and
sys_auth
.
auth_source_type
=
authSourceType
);
delete
from
sys_auth
where
sys_auth
.
auth_source
=
authSource
and
sys_auth
.
auth_source_type
=
authSourceType
;
INSERT
INTO
sys_auth
(
id
,
auth_source
,
auth_source_type
,
auth_target
,
auth_target_type
,
auth_time
,
auth_user
)
VALUES
(
authId
,
authSource
,
authSourceType
,
userId
,
'user'
,
unix_timestamp
(
now
())
*
1000
,
'auto'
);
INSERT
INTO
sys_auth_detail
(
id
,
auth_id
,
privilege_name
,
privilege_type
,
privilege_value
,
privilege_extend
,
remark
,
create_user
,
create_time
)
SELECT
uuid
()
AS
id
,
authId
AS
auth_id
,
sys_auth_detail
.
privilege_name
,
sys_auth_detail
.
privilege_type
,
1
,
sys_auth_detail
.
privilege_extend
,
sys_auth_detail
.
remark
,
'auto'
AS
create_user
,
unix_timestamp
(
now
())
*
1000
AS
create_time
FROM
sys_auth_detail
where
auth_id
=
authSourceType
;
/**继承第一父级权限**/
insert
into
sys_auth
(
id
,
auth_source
,
auth_source_type
,
auth_target
,
auth_target_type
,
auth_time
,
auth_user
,
copy_from
,
copy_id
)
SELECT
uuid
()
as
id
,
authSource
as
auth_source
,
authSourceType
as
auth_source_type
,
auth_target
,
auth_target_type
,
NOW
()
*
1000
as
auth_time
,
'auto'
as
auth_user
,
id
as
copy_from
,
copyId
as
copy_id
FROM
sys_auth
WHERE
auth_source
IN
(
SELECT
pid
FROM
v_auth_model
WHERE
id
=
authSource
AND
model_type
=
authSourceType
)
AND
auth_source_type
=
authSourceType
;
INSERT
INTO
sys_auth_detail
(
id
,
auth_id
,
privilege_name
,
privilege_type
,
privilege_value
,
privilege_extend
,
remark
,
create_user
,
create_time
,
copy_from
,
copy_id
)
SELECT
uuid
()
AS
id
,
sa_copy
.
t_id
AS
auth_id
,
sys_auth_detail
.
privilege_name
,
sys_auth_detail
.
privilege_type
,
sys_auth_detail
.
privilege_value
,
sys_auth_detail
.
privilege_extend
,
sys_auth_detail
.
remark
,
'auto'
AS
create_user
,
unix_timestamp
(
now
())
*
1000
AS
create_time
,
id
AS
copy_from
,
copyId
AS
copy_id
FROM
sys_auth_detail
INNER
JOIN
(
SELECT
id
AS
t_id
,
copy_from
AS
s_id
FROM
sys_auth
WHERE
copy_id
=
copyId
)
sa_copy
ON
sys_auth_detail
.
auth_id
=
sa_copy
.
s_id
;
RETURN
'success'
;
END
;;
delimiter
;
INSERT
INTO
`my_plugin`
(
`plugin_id`
,
`name`
,
`store`
,
`free`
,
`cost`
,
`category`
,
`descript`
,
`version`
,
`install_type`
,
`creator`
,
`load_mybatis`
,
`release_time`
,
`install_time`
,
`module_name`
,
`icon`
)
VALUES
(
3
,
'tabs插件'
,
'default'
,
0
,
20000
,
'panel'
,
'tabs插件'
,
'1.0-SNAPSHOT'
,
NULL
,
'fit2cloud-chenyw'
,
0
,
NULL
,
NULL
,
'dataease-extensions-tabs-backend'
,
NULL
);
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论