Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
4ad858d5
提交
4ad858d5
authored
12月 29, 2021
作者:
wangjiahao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of github.com:dataease/dataease into dev
上级
9fa671d1
f9f1bea6
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
86 行增加
和
32 行删除
+86
-32
RowPermissionsController.java
.../io/dataease/plugins/server/RowPermissionsController.java
+9
-0
DataSetTableService.java
...java/io/dataease/service/dataset/DataSetTableService.java
+9
-0
messages_en_US.properties
backend/src/main/resources/i18n/messages_en_US.properties
+3
-2
messages_zh_CN.properties
backend/src/main/resources/i18n/messages_zh_CN.properties
+3
-2
messages_zh_TW.properties
backend/src/main/resources/i18n/messages_zh_TW.properties
+3
-2
permission.js
frontend/src/permission.js
+31
-7
index.js
frontend/src/utils/index.js
+28
-19
没有找到文件。
backend/src/main/java/io/dataease/plugins/server/RowPermissionsController.java
浏览文件 @
4ad858d5
...
@@ -4,6 +4,7 @@ import com.github.pagehelper.Page;
...
@@ -4,6 +4,7 @@ import com.github.pagehelper.Page;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
io.dataease.commons.utils.PageUtils
;
import
io.dataease.commons.utils.PageUtils
;
import
io.dataease.commons.utils.Pager
;
import
io.dataease.commons.utils.Pager
;
import
io.dataease.i18n.Translator
;
import
io.dataease.plugins.common.entity.XpackConditionEntity
;
import
io.dataease.plugins.common.entity.XpackConditionEntity
;
import
io.dataease.plugins.common.entity.XpackGridRequest
;
import
io.dataease.plugins.common.entity.XpackGridRequest
;
import
io.dataease.plugins.config.SpringContextUtil
;
import
io.dataease.plugins.config.SpringContextUtil
;
...
@@ -11,6 +12,7 @@ import io.dataease.plugins.xpack.auth.dto.request.DataSetRowPermissionsDTO;
...
@@ -11,6 +12,7 @@ import io.dataease.plugins.xpack.auth.dto.request.DataSetRowPermissionsDTO;
import
io.dataease.plugins.xpack.auth.dto.request.DatasetRowPermissions
;
import
io.dataease.plugins.xpack.auth.dto.request.DatasetRowPermissions
;
import
io.dataease.plugins.xpack.auth.service.RowPermissionService
;
import
io.dataease.plugins.xpack.auth.service.RowPermissionService
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -24,6 +26,13 @@ public class RowPermissionsController {
...
@@ -24,6 +26,13 @@ public class RowPermissionsController {
@PostMapping
(
"save"
)
@PostMapping
(
"save"
)
public
void
save
(
@RequestBody
DatasetRowPermissions
datasetRowPermissions
)
throws
Exception
{
public
void
save
(
@RequestBody
DatasetRowPermissions
datasetRowPermissions
)
throws
Exception
{
RowPermissionService
rowPermissionService
=
SpringContextUtil
.
getBean
(
RowPermissionService
.
class
);
RowPermissionService
rowPermissionService
=
SpringContextUtil
.
getBean
(
RowPermissionService
.
class
);
DataSetRowPermissionsDTO
request
=
new
DataSetRowPermissionsDTO
();
request
.
setAuthTargetType
(
datasetRowPermissions
.
getAuthTargetType
());
request
.
setAuthTargetId
(
datasetRowPermissions
.
getAuthTargetId
());
request
.
setDatasetFieldId
(
datasetRowPermissions
.
getDatasetFieldId
());
if
(!
CollectionUtils
.
isEmpty
(
rowPermissionService
.
searchRowPermissions
(
request
))){
throw
new
Exception
(
Translator
.
get
(
"i18n_rp_exist"
));
}
rowPermissionService
.
save
(
datasetRowPermissions
);
rowPermissionService
.
save
(
datasetRowPermissions
);
}
}
...
...
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
浏览文件 @
4ad858d5
...
@@ -504,6 +504,9 @@ public class DataSetTableService {
...
@@ -504,6 +504,9 @@ public class DataSetTableService {
List
<
ChartFieldCustomFilterDTO
>
customFilter
=
new
ArrayList
<>();
List
<
ChartFieldCustomFilterDTO
>
customFilter
=
new
ArrayList
<>();
for
(
DatasetRowPermissions
datasetRowPermissions
:
rowPermissions
(
datasetTable
.
getId
(),
user
))
{
for
(
DatasetRowPermissions
datasetRowPermissions
:
rowPermissions
(
datasetTable
.
getId
(),
user
))
{
ChartFieldCustomFilterDTO
dto
=
new
ChartFieldCustomFilterDTO
();
ChartFieldCustomFilterDTO
dto
=
new
ChartFieldCustomFilterDTO
();
if
(
StringUtils
.
isEmpty
(
datasetRowPermissions
.
getDatasetFieldId
())){
continue
;
}
DatasetTableField
field
=
getFieldById
(
fields
,
datasetRowPermissions
.
getDatasetFieldId
());
DatasetTableField
field
=
getFieldById
(
fields
,
datasetRowPermissions
.
getDatasetFieldId
());
if
(
field
==
null
)
{
if
(
field
==
null
)
{
continue
;
continue
;
...
@@ -512,6 +515,9 @@ public class DataSetTableService {
...
@@ -512,6 +515,9 @@ public class DataSetTableService {
dto
.
setId
(
field
.
getId
());
dto
.
setId
(
field
.
getId
());
dto
.
setFilterType
(
datasetRowPermissions
.
getFilterType
());
dto
.
setFilterType
(
datasetRowPermissions
.
getFilterType
());
if
(
datasetRowPermissions
.
getFilterType
().
equalsIgnoreCase
(
"logic"
))
{
if
(
datasetRowPermissions
.
getFilterType
().
equalsIgnoreCase
(
"logic"
))
{
if
(
StringUtils
.
isEmpty
(
datasetRowPermissions
.
getFilter
())){
continue
;
}
List
<
ChartCustomFilterItemDTO
>
lists
=
JSONObject
.
parseArray
(
datasetRowPermissions
.
getFilter
(),
ChartCustomFilterItemDTO
.
class
);
List
<
ChartCustomFilterItemDTO
>
lists
=
JSONObject
.
parseArray
(
datasetRowPermissions
.
getFilter
(),
ChartCustomFilterItemDTO
.
class
);
lists
.
forEach
(
chartCustomFilterDTO
->
{
lists
.
forEach
(
chartCustomFilterDTO
->
{
chartCustomFilterDTO
.
setFieldId
(
field
.
getId
());
chartCustomFilterDTO
.
setFieldId
(
field
.
getId
());
...
@@ -520,6 +526,9 @@ public class DataSetTableService {
...
@@ -520,6 +526,9 @@ public class DataSetTableService {
dto
.
setLogic
(
datasetRowPermissions
.
getLogic
());
dto
.
setLogic
(
datasetRowPermissions
.
getLogic
());
customFilter
.
add
(
dto
);
customFilter
.
add
(
dto
);
}
else
{
}
else
{
if
(
StringUtils
.
isEmpty
(
datasetRowPermissions
.
getEnumCheckField
())){
continue
;
}
dto
.
setEnumCheckField
(
Arrays
.
asList
(
datasetRowPermissions
.
getEnumCheckField
().
split
(
","
).
clone
()));
dto
.
setEnumCheckField
(
Arrays
.
asList
(
datasetRowPermissions
.
getEnumCheckField
().
split
(
","
).
clone
()));
customFilter
.
add
(
dto
);
customFilter
.
add
(
dto
);
}
}
...
...
backend/src/main/resources/i18n/messages_en_US.properties
浏览文件 @
4ad858d5
...
@@ -296,4 +296,5 @@ i18n_sql_error=SQL Error:
...
@@ -296,4 +296,5 @@ i18n_sql_error=SQL Error:
i18n_invalid_ds
=
Invalid Datasource
i18n_invalid_ds
=
Invalid Datasource
任务管理=Task
Manager
任务管理=Task
Manager
数据同步=Data
Sync
数据同步=Data
Sync
定时报告=Regular
report
定时报告=Regular
report
\ No newline at end of file
i18n_rp_exist
=
Row permission of the same type already exists
\ No newline at end of file
backend/src/main/resources/i18n/messages_zh_CN.properties
浏览文件 @
4ad858d5
...
@@ -295,4 +295,5 @@ i18n_sql_error=SQL 错误:
...
@@ -295,4 +295,5 @@ i18n_sql_error=SQL 错误:
i18n_invalid_ds
=
无效数据源
i18n_invalid_ds
=
无效数据源
任务管理=任务管理
任务管理=任务管理
数据同步=数据同步
数据同步=数据同步
定时报告=定时报告
定时报告=定时报告
\ No newline at end of file
i18n_rp_exist
=
已有同类型的行权限存在
\ No newline at end of file
backend/src/main/resources/i18n/messages_zh_TW.properties
浏览文件 @
4ad858d5
...
@@ -298,4 +298,5 @@ i18n_sql_error=SQL 錯誤:
...
@@ -298,4 +298,5 @@ i18n_sql_error=SQL 錯誤:
i18n_invalid_ds
=
無效數據源
i18n_invalid_ds
=
無效數據源
任务管理=任務管理
任务管理=任務管理
数据同步=數據同步
数据同步=數據同步
定时报告=定時報告
定时报告=定時報告
\ No newline at end of file
i18n_rp_exist
=
已有同類型餓行權限存在
\ No newline at end of file
frontend/src/permission.js
浏览文件 @
4ad858d5
...
@@ -3,19 +3,34 @@ import store from './store'
...
@@ -3,19 +3,34 @@ import store from './store'
// import { Message } from 'element-ui'
// import { Message } from 'element-ui'
import
NProgress
from
'nprogress'
// progress bar
import
NProgress
from
'nprogress'
// progress bar
import
'nprogress/nprogress.css'
// progress bar style
import
'nprogress/nprogress.css'
// progress bar style
import
{
getToken
}
from
'@/utils/auth'
// get token from cookie
import
{
getToken
}
from
'@/utils/auth'
// get token from cookie
import
getPageTitle
from
'@/utils/get-page-title'
import
getPageTitle
from
'@/utils/get-page-title'
import
{
buildMenus
}
from
'@/api/system/menu'
import
{
import
{
filterAsyncRouter
}
from
'@/store/modules/permission'
buildMenus
}
from
'@/api/system/menu'
import
{
filterAsyncRouter
}
from
'@/store/modules/permission'
import
{
isMobile
}
from
'@/utils/index'
// import bus from './utils/bus'
// import bus from './utils/bus'
NProgress
.
configure
({
showSpinner
:
false
})
// NProgress Configuration
NProgress
.
configure
({
showSpinner
:
false
})
// NProgress Configuration
const
whiteList
=
[
'/login'
,
'/401'
,
'/404'
,
'/delink'
,
'/nolic'
]
// no redirect whitelist
const
whiteList
=
[
'/login'
,
'/401'
,
'/404'
,
'/delink'
,
'/nolic'
]
// no redirect whitelist
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
// start progress bar
// start progress bar
NProgress
.
start
()
NProgress
.
start
()
if
(
isMobile
())
{
window
.
location
.
href
=
window
.
origin
+
'/app.html'
NProgress
.
done
()
}
// set page title
// set page title
document
.
title
=
getPageTitle
(
to
.
meta
.
title
)
document
.
title
=
getPageTitle
(
to
.
meta
.
title
)
...
@@ -25,7 +40,9 @@ router.beforeEach(async(to, from, next) => {
...
@@ -25,7 +40,9 @@ router.beforeEach(async(to, from, next) => {
if
(
hasToken
)
{
if
(
hasToken
)
{
if
(
to
.
path
===
'/login'
)
{
if
(
to
.
path
===
'/login'
)
{
// if is logged in, redirect to the home page
// if is logged in, redirect to the home page
next
({
path
:
'/'
})
next
({
path
:
'/'
})
NProgress
.
done
()
NProgress
.
done
()
}
else
{
}
else
{
const
hasGetUserInfo
=
store
.
getters
.
name
const
hasGetUserInfo
=
store
.
getters
.
name
...
@@ -77,11 +94,18 @@ export const loadMenus = (next, to) => {
...
@@ -77,11 +94,18 @@ export const loadMenus = (next, to) => {
const
datas
=
res
.
data
const
datas
=
res
.
data
const
filterDatas
=
filterRouter
(
datas
)
const
filterDatas
=
filterRouter
(
datas
)
const
asyncRouter
=
filterAsyncRouter
(
filterDatas
)
const
asyncRouter
=
filterAsyncRouter
(
filterDatas
)
asyncRouter
.
push
({
path
:
'*'
,
redirect
:
'/404'
,
hidden
:
true
})
asyncRouter
.
push
({
path
:
'*'
,
redirect
:
'/404'
,
hidden
:
true
})
store
.
dispatch
(
'permission/GenerateRoutes'
,
asyncRouter
).
then
(()
=>
{
// 存储路由
store
.
dispatch
(
'permission/GenerateRoutes'
,
asyncRouter
).
then
(()
=>
{
// 存储路由
router
.
addRoutes
(
asyncRouter
)
router
.
addRoutes
(
asyncRouter
)
if
(
pathValid
(
to
.
path
,
asyncRouter
))
{
if
(
pathValid
(
to
.
path
,
asyncRouter
))
{
next
({
...
to
,
replace
:
true
})
next
({
...
to
,
replace
:
true
})
}
else
{
}
else
{
next
(
'/'
)
next
(
'/'
)
}
}
...
...
frontend/src/utils/index.js
浏览文件 @
4ad858d5
import
Cookies
from
'js-cookie'
import
Cookies
from
'js-cookie'
export
function
timeSection
(
date
,
type
)
{
export
function
timeSection
(
date
,
type
)
{
if
(
!
date
)
{
if
(
!
date
)
{
...
@@ -98,7 +97,9 @@ export function parseTime(time, cFormat) {
...
@@ -98,7 +97,9 @@ export function parseTime(time, cFormat) {
const
time_str
=
format
.
replace
(
/{
([
ymdhisa
])
+}/g
,
(
result
,
key
)
=>
{
const
time_str
=
format
.
replace
(
/{
([
ymdhisa
])
+}/g
,
(
result
,
key
)
=>
{
const
value
=
formatObj
[
key
]
const
value
=
formatObj
[
key
]
// Note: getDay() returns 0 on Sunday
// Note: getDay() returns 0 on Sunday
if
(
key
===
'a'
)
{
return
[
'日'
,
'一'
,
'二'
,
'三'
,
'四'
,
'五'
,
'六'
][
value
]
}
if
(
key
===
'a'
)
{
return
[
'日'
,
'一'
,
'二'
,
'三'
,
'四'
,
'五'
,
'六'
][
value
]
}
return
value
.
toString
().
padStart
(
2
,
'0'
)
return
value
.
toString
().
padStart
(
2
,
'0'
)
})
})
return
time_str
return
time_str
...
@@ -115,19 +116,19 @@ export function hasClass(ele, cls) {
...
@@ -115,19 +116,19 @@ export function hasClass(ele, cls) {
}
}
/**
/**
* Add class to element
* Add class to element
* @param {HTMLElement} elm
* @param {HTMLElement} elm
* @param {string} cls
* @param {string} cls
*/
*/
export
function
addClass
(
ele
,
cls
)
{
export
function
addClass
(
ele
,
cls
)
{
if
(
!
hasClass
(
ele
,
cls
))
ele
.
className
+=
' '
+
cls
if
(
!
hasClass
(
ele
,
cls
))
ele
.
className
+=
' '
+
cls
}
}
/**
/**
* Remove class from element
* Remove class from element
* @param {HTMLElement} elm
* @param {HTMLElement} elm
* @param {string} cls
* @param {string} cls
*/
*/
export
function
removeClass
(
ele
,
cls
)
{
export
function
removeClass
(
ele
,
cls
)
{
if
(
hasClass
(
ele
,
cls
))
{
if
(
hasClass
(
ele
,
cls
))
{
const
reg
=
new
RegExp
(
'(
\\
s|^)'
+
cls
+
'(
\\
s|$)'
)
const
reg
=
new
RegExp
(
'(
\\
s|^)'
+
cls
+
'(
\\
s|$)'
)
...
@@ -189,12 +190,12 @@ export function param2Obj(url) {
...
@@ -189,12 +190,12 @@ export function param2Obj(url) {
}
}
return
JSON
.
parse
(
return
JSON
.
parse
(
'{"'
+
'{"'
+
decodeURIComponent
(
search
)
decodeURIComponent
(
search
)
.
replace
(
/"/g
,
'
\\
"'
)
.
replace
(
/"/g
,
'
\\
"'
)
.
replace
(
/&/g
,
'","'
)
.
replace
(
/&/g
,
'","'
)
.
replace
(
/=/g
,
'":"'
)
.
replace
(
/=/g
,
'":"'
)
.
replace
(
/
\+
/g
,
' '
)
+
.
replace
(
/
\+
/g
,
' '
)
+
'"}'
'"}'
)
)
}
}
...
@@ -216,7 +217,9 @@ export function formatCondition(param) {
...
@@ -216,7 +217,9 @@ export function formatCondition(param) {
if
(
!
param
)
{
if
(
!
param
)
{
return
null
return
null
}
}
const
result
=
{
conditions
:
[]
}
const
result
=
{
conditions
:
[]
}
// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line no-unused-vars
for
(
const
[
key
,
value
]
of
Object
.
entries
(
param
))
{
for
(
const
[
key
,
value
]
of
Object
.
entries
(
param
))
{
result
.
conditions
.
push
(
value
)
result
.
conditions
.
push
(
value
)
...
@@ -273,13 +276,19 @@ export function getQueryVariable(variable) {
...
@@ -273,13 +276,19 @@ export function getQueryVariable(variable) {
if
(
!
query
)
{
if
(
!
query
)
{
query
=
Cookies
.
get
(
variable
)
query
=
Cookies
.
get
(
variable
)
}
}
if
(
query
!==
undefined
){
if
(
query
!==
undefined
)
{
const
vars
=
query
.
split
(
'&'
)
const
vars
=
query
.
split
(
'&'
)
for
(
var
i
=
0
;
i
<
vars
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
vars
.
length
;
i
++
)
{
const
pair
=
vars
[
i
].
split
(
'='
)
const
pair
=
vars
[
i
].
split
(
'='
)
if
(
pair
[
0
]
===
variable
)
{
return
pair
[
1
]
}
if
(
pair
[
0
]
===
variable
)
{
return
pair
[
1
]
}
}
}
}
}
return
(
false
)
return
(
false
)
}
}
export
function
isMobile
()
{
const
flag
=
navigator
.
userAgent
.
match
(
/
(
phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone
)
/i
)
return
flag
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论