YARN-8591. [ATSv2] NPE while checking for entity acl in non-secure cluster. Contributed by Rohith Sharma K S.

This commit is contained in:
Sunil G 2018-07-30 14:48:04 +05:30
parent 0857f116b7
commit 63e08ec071
2 changed files with 6 additions and 1 deletions

View File

@ -3532,7 +3532,8 @@ public class TimelineReaderWebServices {
static boolean checkAccess(TimelineReaderManager readerManager,
UserGroupInformation ugi, String entityUser) {
if (isDisplayEntityPerUserFilterEnabled(readerManager.getConfig())) {
if (!validateAuthUserWithEntityUser(readerManager, ugi, entityUser)) {
if (ugi != null && !validateAuthUserWithEntityUser(readerManager, ugi,
entityUser)) {
String userName = ugi.getShortUserName();
String msg = "User " + userName
+ " is not allowed to read TimelineService V2 data.";

View File

@ -88,6 +88,10 @@ public class TestTimelineReaderWebServicesBasicAcl {
Assert.assertFalse(TimelineReaderWebServices
.validateAuthUserWithEntityUser(manager, null, user1));
// true because ugi is null
Assert.assertTrue(
TimelineReaderWebServices.checkAccess(manager, null, user1));
// incoming ugi is admin asking for entity owner user1
Assert.assertTrue(
TimelineReaderWebServices.checkAccess(manager, adminUgi, user1));