RangerBizUtil { public boolean isAdmin() { UserSessionBase currentUserSession = ContextUtil .getCurrentUserSession(); if (currentUserSession == null) { logger.debug("Unable to find session."); return false; } if (currentUserSession.isUserAdmin()) { return true; } return false; } RangerBizUtil(); void checkSystemAdminAccess(); String generatePublicName(VXPortalUser userProfile,
			XXPortalUser gjUser); String generatePublicName(String firstName, String lastName); VXStringList mapStringListToVStringList(List<String> stringList); VXResponse hasPermission(VXResource vXResource, int permission); boolean isAdmin(); boolean isAuditAdmin(); String getCurrentUserLoginId(); Long getXUserId(); void failUnauthenticatedIfNotAllowed(); boolean matchHbasePolicy(String resourceName,
			List<XXResource> xResourceList, VXResponse vXResponse,
			Long xUserId, int permission); boolean matchHivePolicy(String resourceName,
			List<XXResource> xResourceList, Long xUserId, int permission); boolean matchHivePolicy(String resourceName,
			List<XXResource> xResourceList, Long xUserId, int permission,
			int reqTableType, int reqColumnType, boolean isUdfPolicy); String replaceMetaChars(String path); Long getPublicGroupId(); boolean isGroupInList(Long groupId, List<XXGroup> xGroupList); boolean isRecursiveWildCardMatch(String pathToCheck,
			String wildcardPath); List<Integer> getResorceTypeParentHirearchy(int resourceType,
			int assetType); boolean comparePathsForExactMatch(String path1, String path2); boolean nonRecursiveWildCardMatch(String pathToCheck,
			String wildcardPath); static boolean areAllEqual(int checkValue, int... otherValues); void createTrxLog(List<XXTrxLog> trxLogList); static int getDBFlavor(); String getDBVersion(); String getAuditDBType(); void setAuditDBType(String auditDBType); boolean isKeyAdmin(); boolean isAuditKeyAdmin(); Boolean hasAccess(XXDBBase xxDbBase, RangerBaseModelObject baseModel); void hasAdminPermissions(String objType); void hasKMSPermissions(String objType, String implClassName); boolean checkUserAccessible(VXUser vXUser); boolean isSSOEnabled(); boolean isUserAllowed(RangerService rangerService, String cfgNameAllowedUsers); boolean isUserAllowedForGrantRevoke(RangerService rangerService, String userName); boolean isUserRangerAdmin(String username); boolean isUserServiceAdmin(RangerService rangerService, String userName); boolean isUserInConfigParameter(RangerService rangerService, String configParamName, String userName); void blockAuditorRoleUser(); boolean hasModuleAccess(String moduleName); void removeEmptyStrings(List<String> list); void trimAll(List<String> list); static boolean isBulkMode(); static boolean setBulkMode(boolean val); void bulkModeOnlyFlushAndClear(); boolean checkAdminAccess(); final String EMPTY_CONTENT_DISPLAY_NAME; static final String AUDIT_STORE_RDBMS; static final String AUDIT_STORE_SOLR; static final String AUDIT_STORE_ElasticSearch; static final boolean batchClearEnabled; static final int policyBatchSize; static final int batchPersistSize; }
@Test public void testIsNotAdmin(){ boolean isAdminChk = rangerBizUtil.isAdmin(); Assert.assertFalse(isAdminChk); }
@Test public void testIsAdmin(){ UserSessionBase currentUserSession = ContextUtil.getCurrentUserSession(); currentUserSession.setUserAdmin(true); boolean isAdminChk = rangerBizUtil.isAdmin(); Assert.assertTrue(isAdminChk); }
@Test public void testUserSessionNull_forIsAdmin(){ RangerContextHolder.setSecurityContext(null); boolean isAdminChk = rangerBizUtil.isAdmin(); Assert.assertFalse(isAdminChk); }