use of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject in project drill by axbaretto.
the class HiveAuthorizationHelper method authorizeReadTable.
/**
* Check authorization for "READ TABLE" for given db.table. A {@link HiveAccessControlException} is thrown
* for illegal access.
* @param dbName
* @param tableName
*/
public void authorizeReadTable(final String dbName, final String tableName) throws HiveAccessControlException {
if (!authzEnabled) {
return;
}
HivePrivilegeObject toRead = new HivePrivilegeObject(HivePrivilegeObjectType.TABLE_OR_VIEW, dbName, tableName);
authorize(HiveOperationType.QUERY, ImmutableList.of(toRead), Collections.<HivePrivilegeObject>emptyList(), "READ TABLE");
}
use of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject in project hive by apache.
the class AlterDatabaseEvent method getOutputHObjs.
private List<HivePrivilegeObject> getOutputHObjs() {
LOG.debug("==> AlterDatabaseEvent.getOutputHObjs()");
List<HivePrivilegeObject> ret = new ArrayList<>();
PreAlterDatabaseEvent event = (PreAlterDatabaseEvent) preEventContext;
Database database = event.getNewDatabase();
if (database != null) {
ret.add(getHivePrivilegeObject(database));
String newUri = (database != null) ? database.getLocationUri() : "";
if (StringUtils.isNotEmpty(newUri)) {
ret.add(getHivePrivilegeObjectDfsUri(newUri));
}
COMMAND_STR = buildCommandString(COMMAND_STR, database);
LOG.debug("<== AlterDatabaseEvent.getOutputHObjs(): ret={}", ret);
}
return ret;
}
use of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject in project hive by apache.
the class HiveMetaStoreAuthorizer method getFilteredDatabaseList.
private List<String> getFilteredDatabaseList(List<HivePrivilegeObject> hivePrivilegeObjects) {
List<String> ret = new ArrayList<>();
for (HivePrivilegeObject hivePrivilegeObject : hivePrivilegeObjects) {
String dbName = hivePrivilegeObject.getDbname();
ret.add(dbName);
}
return ret;
}
use of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject in project hive by apache.
the class AddPartitionEvent method getOutputHObjs.
private List<HivePrivilegeObject> getOutputHObjs() {
LOG.debug("==> AddPartitionEvent.getOutputHObjs()");
List<HivePrivilegeObject> ret = new ArrayList<>();
PreAddPartitionEvent event = (PreAddPartitionEvent) preEventContext;
Table table = event.getTable();
ret.add(getHivePrivilegeObject(table));
List<Partition> partitions = event.getPartitions();
if (partitions != null) {
for (Partition partition : partitions) {
String uri = getSdLocation(partition.getSd());
if (StringUtils.isNotEmpty(uri)) {
ret.add(getHivePrivilegeObjectDfsUri(uri));
}
}
}
COMMAND_STR = buildCommandString(COMMAND_STR, table);
LOG.debug("<== AddPartitionEvent.getOutputHObjs(): ret={}", ret);
return ret;
}
use of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject in project hive by apache.
the class CreateDatabaseEvent method getOutputHObjs.
private List<HivePrivilegeObject> getOutputHObjs() {
LOG.debug("==> CreateDatabaseEvent.getOutputHObjs()");
List<HivePrivilegeObject> ret = new ArrayList<>();
PreCreateDatabaseEvent event = (PreCreateDatabaseEvent) preEventContext;
Database database = event.getDatabase();
String uri = (database != null) ? database.getLocationUri() : "";
if (database != null) {
ret.add(getHivePrivilegeObject(database));
if (StringUtils.isNotEmpty(uri)) {
ret.add(getHivePrivilegeObjectDfsUri(uri));
}
COMMAND_STR = buildCommandString(COMMAND_STR, database);
LOG.debug("<== CreateDatabaseEvent.getOutputHObjs(): ret={}", ret);
}
return ret;
}
Aggregations