This is an automated email from the ASF dual-hosted git repository.
rameshkumar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 4622860b8c HIVE-26219 Encapsulate the API change for
FileUtils.isActionPermittedForFileHierarchy (#3278)
4622860b8c is described below
commit 4622860b8c7dbddaf4c556e65c5039c60da15e82
Author: Ramesh Kumar <[email protected]>
AuthorDate: Tue May 10 16:17:25 2022 -0700
HIVE-26219 Encapsulate the API change for
FileUtils.isActionPermittedForFileHierarchy (#3278)
---
.../src/java/org/apache/hadoop/hive/common/FileUtils.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
b/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
index f3290f69a1..e9410ec4d0 100644
--- a/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
+++ b/common/src/java/org/apache/hadoop/hive/common/FileUtils.java
@@ -532,6 +532,20 @@ public final class FileUtils {
return isPermitted;
}
+ public static boolean isActionPermittedForFileHierarchy(FileSystem fs,
FileStatus fileStatus,
+ String userName, FsAction action, boolean recurse) throws Exception {
+ UserGroupInformation proxyUser = null;
+ boolean isPermitted;
+ try {
+ proxyUser = getProxyUser(userName);
+ FileSystem fsAsUser = getFsAsUser(fs, proxyUser);
+ isPermitted = isActionPermittedForFileHierarchy(fs, fileStatus,
userName, action, recurse, fsAsUser);
+ } finally {
+ closeFs(proxyUser);
+ }
+ return isPermitted;
+ }
+
@SuppressFBWarnings(value = "DLS_DEAD_LOCAL_STORE", justification =
"Intended, dir privilege all-around bug")
public static boolean isActionPermittedForFileHierarchy(FileSystem fs,
FileStatus fileStatus,
String userName, FsAction action, boolean recurse, FileSystem fsAsUser)
throws Exception {