权限认证出现问题

没判断方法名是否与预期方法名一致就开始判断是否需要权限控制了
This commit is contained in:
lk
2024-04-22 16:32:38 +08:00
parent 723ca94495
commit ecfb2303ea

View File

@@ -32,12 +32,12 @@ public class MyDataPermissionHandler implements DataPermissionHandler {
String methodName = mappedStatementId.substring(mappedStatementId.lastIndexOf(StringPool.DOT) + 1);
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals(methodName)) {
DataPermission annotation = method.getAnnotation(DataPermission.class);
// 如果没有注解或者是超级管理员,直接返回
if (annotation == null || SecurityUtils.isRoot()) {
if (annotation == null || SecurityUtils.isRoot() ) {
return where;
}
if (method.getName().equals(methodName) || (method.getName() + "_COUNT").equals(methodName)) {
return dataScopeFilter(annotation.deptAlias(), annotation.deptIdColumnName(), annotation.userAlias(), annotation.userIdColumnName(), where);
}
}