rbalamohan commented on code in PR #3264:
URL: https://github.com/apache/hive/pull/3264#discussion_r868545895
##########
common/src/java/org/apache/hadoop/hive/common/FileUtils.java:
##########
@@ -493,12 +505,28 @@ private static void addChildren(FileSystem fsAsUser, Path
path, List<FileStatus>
*/
public static boolean isActionPermittedForFileHierarchy(FileSystem fs,
FileStatus fileStatus,
String userName,
FsAction action) throws Exception {
- return isActionPermittedForFileHierarchy(fs,fileStatus,userName, action,
true);
+ UserGroupInformation ugi = Utils.getUGI();
+ String currentUser = ugi.getShortUserName();
+ FileSystem fsAsUser = null;
+ UserGroupInformation proxyUser = null;
+ boolean isPermitted = false;
+ try {
+ if (userName != null && !userName.equals(currentUser)) {
+ proxyUser = UserGroupInformation.createProxyUser(userName,
UserGroupInformation.getLoginUser());
+ fsAsUser = getFsAsUser(fs, proxyUser);
+ }
Review Comment:
Can you try moving this to separate method? This is duplicated in multiple
places.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]