Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
3c47f7fa
提交
3c47f7fa
编写于
5月 22, 2020
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
补充save鉴权
上级
8914f35a
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
57 行增加
和
0 行删除
+57
-0
%ITEM%Resource.java.ftl
...YS_PKGPATH%/%SYSAPI_PKGPATH%/rest/%ITEM%Resource.java.ftl
+8
-0
AuthPermissionEvaluator.java.ftl
...S_PKGPATH%/util/security/AuthPermissionEvaluator.java.ftl
+49
-0
未找到文件。
SLN/%PUBPRJ%-provider/%PUBPRJ%-provider-%SYSAPI_PKGPATH%/src/main/java/%SYS_PKGPATH%/%SYSAPI_PKGPATH%/rest/%ITEM%Resource.java.ftl
浏览文件 @
3c47f7fa
...
@@ -199,7 +199,11 @@ public class ${itemCodeName}Resource {
...
@@ -199,7 +199,11 @@ public class ${itemCodeName}Resource {
}
}
<#
elseif
deaction
.
codeName
?
lower_case
==
'save'
>
<#
elseif
deaction
.
codeName
?
lower_case
==
'save'
>
<#
if
noDEPrefield
>
<@
outputHasAnyAuthorityAnnotation
'${sys.codeName}-${de.codeName}-${deaction.codeName}-all'
/>
<@
outputHasAnyAuthorityAnnotation
'${sys.codeName}-${de.codeName}-${deaction.codeName}-all'
/>
<#
else
>
@
PreAuthorize
(
"hasPermission('','Save',{'${deStorageMode}',this.${itemCodeNameLC}Mapping,#${itemCodeNameLC}dto})"
)
</#
if
>
@
ApiOperation
(
value
=
"${deaction.getLogicName()}"
,
tags
=
{
"${itemCodeName}"
},
notes
=
"${deaction.getLogicName()}"
)
@
ApiOperation
(
value
=
"${deaction.getLogicName()}"
,
tags
=
{
"${itemCodeName}"
},
notes
=
"${deaction.getLogicName()}"
)
@
RequestMapping
(
method
=
RequestMethod
.${
reqMtd
},
value
=
"${fullPath}/${deactionCodeName?lower_case}"
)
@
RequestMapping
(
method
=
RequestMethod
.${
reqMtd
},
value
=
"${fullPath}/${deactionCodeName?lower_case}"
)
public
ResponseEntity
<
Boolean
>
save
(${
etParams
})
{
public
ResponseEntity
<
Boolean
>
save
(${
etParams
})
{
...
@@ -534,7 +538,11 @@ public class ${itemCodeName}Resource {
...
@@ -534,7 +538,11 @@ public class ${itemCodeName}Resource {
}
}
<#
elseif
deaction
.
codeName
?
lower_case
==
'save'
>
<#
elseif
deaction
.
codeName
?
lower_case
==
'save'
>
<#
if
noDEPrefield
>
<@
outputHasAnyAuthorityAnnotation
'${sys.codeName}-${de.codeName}-${deaction.codeName}-all'
/>
<@
outputHasAnyAuthorityAnnotation
'${sys.codeName}-${de.codeName}-${deaction.codeName}-all'
/>
<#
else
>
@
PreAuthorize
(
"hasPermission('','Save',{'${deStorageMode}',this.${itemCodeNameLC}Mapping,#${itemCodeNameLC}dto})"
)
</#
if
>
@
ApiOperation
(
value
=
"${deaction.getLogicName()}${byParams}"
,
tags
=
{
"${itemCodeName}"
},
notes
=
"${deaction.getLogicName()}${byParams}"
)
@
ApiOperation
(
value
=
"${deaction.getLogicName()}${byParams}"
,
tags
=
{
"${itemCodeName}"
},
notes
=
"${deaction.getLogicName()}${byParams}"
)
@
RequestMapping
(
method
=
RequestMethod
.${
reqMtd
},
value
=
"${fullPath}/${deactionCodeName?lower_case}"
)
@
RequestMapping
(
method
=
RequestMethod
.${
reqMtd
},
value
=
"${fullPath}/${deactionCodeName?lower_case}"
)
public
ResponseEntity
<
Boolean
>
${
deactionCodeName
?
uncap_first
}${
byParams
}(${
etParams
})
{
public
ResponseEntity
<
Boolean
>
${
deactionCodeName
?
uncap_first
}${
byParams
}(${
etParams
})
{
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/security/AuthPermissionEvaluator.java.ftl
浏览文件 @
3c47f7fa
...
@@ -107,6 +107,9 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
...
@@ -107,6 +107,9 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
if
(
action
.
equalsIgnoreCase
(
"create"
)){
if
(
action
.
equalsIgnoreCase
(
"create"
)){
return
createBatchActionPermissionValid
(
entityList
,
dataRangeList
);
return
createBatchActionPermissionValid
(
entityList
,
dataRangeList
);
}
}
else
if
(
action
.
equalsIgnoreCase
(
"save"
)){
return
saveBatchActionPermissionValid
(
deStorageMode
,
entityList
,
dataRangeList
);
}
else
{
else
{
if
(
!action.equalsIgnoreCase("remove")){
if
(
!action.equalsIgnoreCase("remove")){
ids
=
getIds
(
entity
,
entityList
);
ids
=
getIds
(
entity
,
entityList
);
...
@@ -117,6 +120,43 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
...
@@ -117,6 +120,43 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
}
}
}
}
/**
*
批
save
校验
*
@
param
deStorageMode
*
@
param
entityList
*
@
param
dataRangeList
*
@
return
*/
private
boolean
saveBatchActionPermissionValid
(
String
deStorageMode
,
List
<
EntityBase
>
entityList
,
JSONArray
dataRangeList
)
{
if
(
entityList
==
null
||
entityList
.
size
()==
0
)
return
false
;
EntityBase
tempEntity
=
entityList
.
get
(
0
);
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
tempEntity
);
String
keyFieldName
=
permissionField
.
get
(
keyFieldTag
);
List
createList
=
new
ArrayList
();
List
<
String
>
updateList
=
new
ArrayList
();
for
(
EntityBase
entity
:
entityList
){
Object
id
=
entity
.
get
(
keyFieldName
);
if
(
ObjectUtils
.
isEmpty
(
id
))
createList
.
add
(
entity
);
else
updateList
.
add
(
String
.
valueOf
(
id
));
}
if
(
updateList
.
size
()>
0
){
boolean
isUpdate
=
otherBatchActionPermissionValidRouter
(
deStorageMode
,
tempEntity
,
updateList
,
dataRangeList
);
if
(
!isUpdate)
return
false
;
}
if
(
createList
.
size
()>
0
){
boolean
isCreate
=
createBatchActionPermissionValid
(
entityList
,
dataRangeList
);
if
(
!isCreate)
return
false
;
}
return
true
;
}
/**
/**
*
实体行为权限检查
:用于检查当前用户是否拥有实体的新建、编辑、删除权限
*
实体行为权限检查
:用于检查当前用户是否拥有实体的新建、编辑、删除权限
*
*
...
@@ -160,6 +200,15 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
...
@@ -160,6 +200,15 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
if
(
dataRangeList
.
size
()==
0
)
if
(
dataRangeList
.
size
()==
0
)
return
false
;
return
false
;
if
(
action
.
equalsIgnoreCase
(
"save"
)){
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
entity
);
String
keyFieldName
=
permissionField
.
get
(
keyFieldTag
);
Object
srfKey
=
entity
.
get
(
keyFieldName
);
if
(
ObjectUtils
.
isEmpty
(
srfKey
))
action
=
"create"
;
else
action
=
"update"
;
}
if
(
action
.
equalsIgnoreCase
(
"create"
)){
if
(
action
.
equalsIgnoreCase
(
"create"
)){
return
createActionPermissionValid
(
entity
,
dataRangeList
);
return
createActionPermissionValid
(
entity
,
dataRangeList
);
}
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录