@Test public void testValidateMorePermissive() { assertConsistentFsPermissionBehaviour(FsAction.ALL, true, true, true, true, true, true, true, true); assertConsistentFsPermissionBehaviour(FsAction.READ, false, true, false, true, false, false, false, false); assertConsistentFsPermissionBehaviour(FsAction.WRITE, false, true, false, false, true, false, false, false); assertConsistentFsPermissionBehaviour(FsAction.EXECUTE, false, true, true, false, false, false, false, false); assertConsistentFsPermissionBehaviour(FsAction.READ_EXECUTE, false, true, true, true, false, true, false, false); assertConsistentFsPermissionBehaviour(FsAction.READ_WRITE, false, true, false, true, true, false, true, false); assertConsistentFsPermissionBehaviour(FsAction.WRITE_EXECUTE, false, true, true, false, true, false, false, true); assertConsistentFsPermissionBehaviour(FsAction.NONE, false, true, false, false, false, false, false, false); }
public static boolean validateMorePermissive(FsAction first, FsAction second) { if ((first == FsAction.ALL) || (second == FsAction.NONE) || (first == second)) { return true; } switch (first) { case READ_EXECUTE: return ((second == FsAction.READ) || (second == FsAction.EXECUTE)); case READ_WRITE: return ((second == FsAction.READ) || (second == FsAction.WRITE)); case WRITE_EXECUTE: return ((second == FsAction.WRITE) || (second == FsAction.EXECUTE)); } return false; }
HCatUtil { public static boolean validateMorePermissive(FsAction first, FsAction second) { if ((first == FsAction.ALL) || (second == FsAction.NONE) || (first == second)) { return true; } switch (first) { case READ_EXECUTE: return ((second == FsAction.READ) || (second == FsAction.EXECUTE)); case READ_WRITE: return ((second == FsAction.READ) || (second == FsAction.WRITE)); case WRITE_EXECUTE: return ((second == FsAction.WRITE) || (second == FsAction.EXECUTE)); } return false; } }
HCatUtil { public static boolean validateMorePermissive(FsAction first, FsAction second) { if ((first == FsAction.ALL) || (second == FsAction.NONE) || (first == second)) { return true; } switch (first) { case READ_EXECUTE: return ((second == FsAction.READ) || (second == FsAction.EXECUTE)); case READ_WRITE: return ((second == FsAction.READ) || (second == FsAction.WRITE)); case WRITE_EXECUTE: return ((second == FsAction.WRITE) || (second == FsAction.EXECUTE)); } return false; }  }
HCatUtil { public static boolean validateMorePermissive(FsAction first, FsAction second) { if ((first == FsAction.ALL) || (second == FsAction.NONE) || (first == second)) { return true; } switch (first) { case READ_EXECUTE: return ((second == FsAction.READ) || (second == FsAction.EXECUTE)); case READ_WRITE: return ((second == FsAction.READ) || (second == FsAction.WRITE)); case WRITE_EXECUTE: return ((second == FsAction.WRITE) || (second == FsAction.EXECUTE)); } return false; }  static boolean checkJobContextIfRunningFromBackend(JobContext j); static String serialize(Serializable obj); static Object deserialize(String str); static String encodeBytes(byte[] bytes); static byte[] decodeBytes(String str); static List<HCatFieldSchema> getHCatFieldSchemaList(
    FieldSchema... fields); static List<HCatFieldSchema> getHCatFieldSchemaList(
    List<FieldSchema> fields); static HCatSchema extractSchema(Table table); static HCatSchema extractSchema(Partition partition); static List<FieldSchema> getFieldSchemaList(
    List<HCatFieldSchema> hcatFields); static Table getTable(HiveMetaStoreClient client, String dbName, String tableName); static HCatSchema getTableSchemaWithPtnCols(Table table); static HCatSchema getPartitionColumns(Table table); static List<FieldSchema> validatePartitionSchema(Table table,
                              HCatSchema partitionSchema); static boolean validateMorePermissive(FsAction first, FsAction second); static boolean validateExecuteBitPresentIfReadOrWrite(FsAction perms); static Token<org.apache.hadoop.mapreduce.security.token.delegation.DelegationTokenIdentifier> getJobTrackerDelegationToken(
    Configuration conf, String userName); static Token<? extends AbstractDelegationTokenIdentifier> extractThriftToken(
    String tokenStrForm, String tokenSignature); static HCatStorageHandler getStorageHandler(Configuration conf, StorerInfo storerInfo); static HCatStorageHandler getStorageHandler(Configuration conf, PartInfo partitionInfo); static HCatStorageHandler getStorageHandler(Configuration conf,
                             String storageHandler,
                             String serDe,
                             String inputFormat,
                             String outputFormat); static Pair<String, String> getDbAndTableName(String tableName); static Map<String, String> getInputJobProperties(HCatStorageHandler storageHandler,
              InputJobInfo inputJobInfo); @InterfaceAudience.Private @InterfaceStability.Evolving static void configureOutputStorageHandler(HCatStorageHandler storageHandler,
                  Configuration conf,
                  OutputJobInfo outputJobInfo); static void copyConf(Configuration src, Configuration dest); static HiveMetaStoreClient getHiveClient(HiveConf hiveConf); static void closeHiveClientQuietly(HiveMetaStoreClient client); static HiveConf getHiveConf(Configuration conf); static JobConf getJobConfFromContext(JobContext jobContext); static void copyJobPropertiesToJobConf(
    Map<String, String> jobProperties, JobConf jobConf); static boolean isHadoop23(); }
HCatUtil { public static boolean validateMorePermissive(FsAction first, FsAction second) { if ((first == FsAction.ALL) || (second == FsAction.NONE) || (first == second)) { return true; } switch (first) { case READ_EXECUTE: return ((second == FsAction.READ) || (second == FsAction.EXECUTE)); case READ_WRITE: return ((second == FsAction.READ) || (second == FsAction.WRITE)); case WRITE_EXECUTE: return ((second == FsAction.WRITE) || (second == FsAction.EXECUTE)); } return false; }  static boolean checkJobContextIfRunningFromBackend(JobContext j); static String serialize(Serializable obj); static Object deserialize(String str); static String encodeBytes(byte[] bytes); static byte[] decodeBytes(String str); static List<HCatFieldSchema> getHCatFieldSchemaList(
    FieldSchema... fields); static List<HCatFieldSchema> getHCatFieldSchemaList(
    List<FieldSchema> fields); static HCatSchema extractSchema(Table table); static HCatSchema extractSchema(Partition partition); static List<FieldSchema> getFieldSchemaList(
    List<HCatFieldSchema> hcatFields); static Table getTable(HiveMetaStoreClient client, String dbName, String tableName); static HCatSchema getTableSchemaWithPtnCols(Table table); static HCatSchema getPartitionColumns(Table table); static List<FieldSchema> validatePartitionSchema(Table table,
                              HCatSchema partitionSchema); static boolean validateMorePermissive(FsAction first, FsAction second); static boolean validateExecuteBitPresentIfReadOrWrite(FsAction perms); static Token<org.apache.hadoop.mapreduce.security.token.delegation.DelegationTokenIdentifier> getJobTrackerDelegationToken(
    Configuration conf, String userName); static Token<? extends AbstractDelegationTokenIdentifier> extractThriftToken(
    String tokenStrForm, String tokenSignature); static HCatStorageHandler getStorageHandler(Configuration conf, StorerInfo storerInfo); static HCatStorageHandler getStorageHandler(Configuration conf, PartInfo partitionInfo); static HCatStorageHandler getStorageHandler(Configuration conf,
                             String storageHandler,
                             String serDe,
                             String inputFormat,
                             String outputFormat); static Pair<String, String> getDbAndTableName(String tableName); static Map<String, String> getInputJobProperties(HCatStorageHandler storageHandler,
              InputJobInfo inputJobInfo); @InterfaceAudience.Private @InterfaceStability.Evolving static void configureOutputStorageHandler(HCatStorageHandler storageHandler,
                  Configuration conf,
                  OutputJobInfo outputJobInfo); static void copyConf(Configuration src, Configuration dest); static HiveMetaStoreClient getHiveClient(HiveConf hiveConf); static void closeHiveClientQuietly(HiveMetaStoreClient client); static HiveConf getHiveConf(Configuration conf); static JobConf getJobConfFromContext(JobContext jobContext); static void copyJobPropertiesToJobConf(
    Map<String, String> jobProperties, JobConf jobConf); static boolean isHadoop23();  }