Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
fbed25f9
提交
fbed25f9
authored
3月 28, 2022
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: aop中不能捕获原方法异常堆栈
上级
2213a565
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
19 行增加
和
13 行删除
+19
-13
DePermissionAnnotationHandler.java
...a/io/dataease/auth/aop/DePermissionAnnotationHandler.java
+18
-13
index.scss
frontend/src/styles/index.scss
+1
-0
没有找到文件。
backend/src/main/java/io/dataease/auth/aop/DePermissionAnnotationHandler.java
浏览文件 @
fbed25f9
...
@@ -26,12 +26,14 @@ import java.util.stream.Collectors;
...
@@ -26,12 +26,14 @@ import java.util.stream.Collectors;
public
class
DePermissionAnnotationHandler
{
public
class
DePermissionAnnotationHandler
{
@Around
(
value
=
"@annotation(io.dataease.auth.annotation.DePermissions)"
)
@Around
(
value
=
"@annotation(io.dataease.auth.annotation.DePermissions)"
)
public
Object
PermissionsAround
(
ProceedingJoinPoint
point
)
{
public
Object
PermissionsAround
(
ProceedingJoinPoint
point
)
throws
Throwable
{
if
(
AuthUtils
.
getUser
().
getIsAdmin
())
{
return
point
.
proceed
(
point
.
getArgs
());
}
Boolean
access
=
false
;
try
{
try
{
if
(
AuthUtils
.
getUser
().
getIsAdmin
())
{
return
point
.
proceed
(
point
.
getArgs
());
}
MethodSignature
ms
=
(
MethodSignature
)
point
.
getSignature
();
MethodSignature
ms
=
(
MethodSignature
)
point
.
getSignature
();
Method
method
=
ms
.
getMethod
();
Method
method
=
ms
.
getMethod
();
DePermissions
annotation
=
method
.
getAnnotation
(
DePermissions
.
class
);
DePermissions
annotation
=
method
.
getAnnotation
(
DePermissions
.
class
);
...
@@ -43,37 +45,40 @@ public class DePermissionAnnotationHandler {
...
@@ -43,37 +45,40 @@ public class DePermissionAnnotationHandler {
DePermission
permission
=
dePermissions
[
i
];
DePermission
permission
=
dePermissions
[
i
];
boolean
currentAccess
=
access
(
args
[
permission
.
paramIndex
()],
permission
,
0
);
boolean
currentAccess
=
access
(
args
[
permission
.
paramIndex
()],
permission
,
0
);
if
(!
currentAccess
)
{
if
(!
currentAccess
)
{
return
null
;
access
=
false
;
break
;
}
}
}
}
}
else
{
}
else
{
List
<
Exception
>
exceptions
=
new
ArrayList
<>();
List
<
Exception
>
exceptions
=
new
ArrayList
<>();
Boolean
someAccess
=
false
;
for
(
int
i
=
0
;
i
<
dePermissions
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
dePermissions
.
length
;
i
++)
{
DePermission
permission
=
dePermissions
[
i
];
DePermission
permission
=
dePermissions
[
i
];
try
{
try
{
boolean
currentAccess
=
access
(
args
[
permission
.
paramIndex
()],
permission
,
0
);
boolean
currentAccess
=
access
(
args
[
permission
.
paramIndex
()],
permission
,
0
);
if
(
currentAccess
)
{
if
(
currentAccess
)
{
someA
ccess
=
true
;
a
ccess
=
true
;
break
;
break
;
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
exceptions
.
add
(
e
);
exceptions
.
add
(
e
);
}
}
}
}
if
(!
someAccess
)
{
if
(!
access
&&
exceptions
.
size
()
>
0
)
{
throw
exceptions
.
get
(
0
);
throw
exceptions
.
get
(
0
);
}
}
}
}
return
point
.
proceed
(
point
.
getArgs
());
}
catch
(
Throwable
throwable
)
{
}
catch
(
Throwable
throwable
)
{
LogUtil
.
error
(
throwable
.
getMessage
(),
throwable
);
LogUtil
.
error
(
throwable
.
getMessage
(),
throwable
);
throw
new
RuntimeException
(
throwable
.
getMessage
());
throw
new
RuntimeException
(
throwable
.
getMessage
());
}
}
return
access
?
point
.
proceed
(
point
.
getArgs
())
:
null
;
}
}
@Around
(
value
=
"@annotation(io.dataease.auth.annotation.DePermission)"
)
@Around
(
value
=
"@annotation(io.dataease.auth.annotation.DePermission)"
)
public
Object
PermissionAround
(
ProceedingJoinPoint
point
)
{
public
Object
PermissionAround
(
ProceedingJoinPoint
point
)
throws
Throwable
{
Boolean
access
=
false
;
try
{
try
{
if
(
AuthUtils
.
getUser
().
getIsAdmin
())
{
if
(
AuthUtils
.
getUser
().
getIsAdmin
())
{
return
point
.
proceed
(
point
.
getArgs
());
return
point
.
proceed
(
point
.
getArgs
());
...
@@ -84,14 +89,14 @@ public class DePermissionAnnotationHandler {
...
@@ -84,14 +89,14 @@ public class DePermissionAnnotationHandler {
DePermission
annotation
=
method
.
getAnnotation
(
DePermission
.
class
);
DePermission
annotation
=
method
.
getAnnotation
(
DePermission
.
class
);
Object
arg
=
point
.
getArgs
()[
annotation
.
paramIndex
()];
Object
arg
=
point
.
getArgs
()[
annotation
.
paramIndex
()];
if
(
access
(
arg
,
annotation
,
0
))
{
if
(
access
(
arg
,
annotation
,
0
))
{
return
point
.
proceed
(
point
.
getArgs
())
;
access
=
true
;
}
}
return
false
;
}
catch
(
Throwable
throwable
)
{
}
catch
(
Throwable
throwable
)
{
LogUtil
.
error
(
throwable
.
getMessage
(),
throwable
);
LogUtil
.
error
(
throwable
.
getMessage
(),
throwable
);
throw
new
RuntimeException
(
throwable
.
getMessage
());
throw
new
RuntimeException
(
throwable
.
getMessage
());
}
}
return
access
?
point
.
proceed
(
point
.
getArgs
())
:
null
;
}
}
private
Boolean
access
(
Object
arg
,
DePermission
annotation
,
int
layer
)
throws
Exception
{
private
Boolean
access
(
Object
arg
,
DePermission
annotation
,
int
layer
)
throws
Exception
{
...
...
frontend/src/styles/index.scss
浏览文件 @
fbed25f9
...
@@ -151,6 +151,7 @@ div:focus {
...
@@ -151,6 +151,7 @@ div:focus {
.el-tabs__content
{
.el-tabs__content
{
height
:
calc
(
100%
-
55px
)
!
important
;
height
:
calc
(
100%
-
55px
)
!
important
;
margin-top
:
5px
;
.el-tab-pane
{
.el-tab-pane
{
height
:
100%
!
important
;
height
:
100%
!
important
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论