Skip to content

Commit

Permalink
feat: 解析udf函数添加权限控制
Browse files Browse the repository at this point in the history
  • Loading branch information
taoran1250 committed Dec 16, 2024
1 parent ffee469 commit 2c23411
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1448,12 +1448,18 @@ public Message getRegisterFunctions(HttpServletRequest req, @RequestParam("path"
if (StringUtils.endsWithIgnoreCase(path, Constants.FILE_EXTENSION_PY)
|| StringUtils.endsWithIgnoreCase(path, Constants.FILE_EXTENSION_SCALA)) {
try {
// 获取登录用户
String username = ModuleUserUtils.getOperationUser(req, "get-register-functions");
FsPath fsPath = new FsPath(path);
// 获取文件系统实例
FileSystem fileSystem = (FileSystem) FSFactory.getFs(fsPath);
fileSystem.init(null);
return Message.ok()
.data("functions", UdfUtils.getRegisterFunctions(fileSystem, fsPath, path));
if (udfService.isUDFManager(username) || username.equalsIgnoreCase(fileSystem.getUser())) {
return Message.ok()
.data("functions", UdfUtils.getRegisterFunctions(fileSystem, fsPath, path));
} else {
return Message.error("您没有权限访问该文件");
}
} catch (Exception e) {
return Message.error("解析文件失败,错误信息:" + e);
}
Expand Down

0 comments on commit 2c23411

Please sign in to comment.