Package org.apache.hadoop.hive.metastore.api

Examples of org.apache.hadoop.hive.metastore.api.PrincipalType


    }
  }

  @Override
  public List<HiveRoleGrant> getRoleGrantInfoForPrincipal(HivePrincipal principal) throws HiveAuthzPluginException, HiveAccessControlException {
    PrincipalType type = AuthorizationUtils.getThriftPrincipalType(principal.getType());
    try {
      List<HiveRoleGrant> grants = new ArrayList<HiveRoleGrant>();
      for (RolePrincipalGrant grant : hive.getRoleGrantInfoForPrincipal(principal.getName(), type)) {
        grants.add(new HiveRoleGrant(grant));
      }
View Full Code Here


    }
  }

  private void grantOrRevokeRole(List<HivePrincipal> principals, List<String> roles,
      boolean grantOption, HivePrincipal grantor, boolean isGrant) throws HiveException {
    PrincipalType grantorType = AuthorizationUtils.getThriftPrincipalType(grantor.getType());
    for (HivePrincipal principal : principals) {
      PrincipalType principalType = AuthorizationUtils.getThriftPrincipalType(principal.getType());
      String userName = principal.getName();
      for (String roleName : roles) {
        if (isGrant) {
          hive.grantRole(roleName, userName, principalType,
              grantor.getName(), grantorType, grantOption);
View Full Code Here

  @Override
  public List<HivePrivilegeInfo> showPrivileges(HivePrincipal principal, HivePrivilegeObject privObj)
      throws HiveAuthzPluginException, HiveAccessControlException {
    String name = principal == null ? null : principal.getName();
    PrincipalType type =
        AuthorizationUtils.getThriftPrincipalType(principal == null ? null : principal.getType());

    List<HiveObjectPrivilege> privs = new ArrayList<HiveObjectPrivilege>();
    try {
      if (privObj == null) {
View Full Code Here

        }
      }
      IMetaStoreClient mClient = metastoreClientFactory.getHiveMetastoreClient();
      List<HivePrivilegeInfo> resPrivInfos = new ArrayList<HivePrivilegeInfo>();
      String principalName = principal == null ? null : principal.getName();
      PrincipalType principalType = principal == null ? null :
          AuthorizationUtils.getThriftPrincipalType(principal.getType());

      // get metastore/thrift privilege object using metastore api
      List<HiveObjectPrivilege> msObjPrivs = mClient.list_privileges(principalName,
          principalType,
View Full Code Here

  }
  @Override
  public Task<? extends Serializable> createShowRoleGrantTask(ASTNode ast, Path resultFile,
      HashSet<ReadEntity> inputs, HashSet<WriteEntity> outputs) {
    ASTNode child = (ASTNode) ast.getChild(0);
    PrincipalType principalType = PrincipalType.USER;
    switch (child.getType()) {
    case HiveParser.TOK_USER:
      principalType = PrincipalType.USER;
      break;
    case HiveParser.TOK_GROUP:
View Full Code Here

      throws HiveAuthzPluginException {
    try {
      IMetaStoreClient mClient = metastoreClientFactory.getHiveMetastoreClient();
      List<HivePrivilegeInfo> resPrivInfos = new ArrayList<HivePrivilegeInfo>();
      String principalName = principal == null ? null : principal.getName();
      PrincipalType principalType = principal == null ? null :
          AuthorizationUtils.getThriftPrincipalType(principal.getType());

      // get metastore/thrift privilege object using metastore api
      List<HiveObjectPrivilege> msObjPrivs = mClient.list_privileges(principalName,
          principalType,
View Full Code Here

    }

    PrincipalDesc principalDesc = showGrantDesc.getPrincipalDesc();
    PrivilegeObjectDesc hiveObjectDesc = showGrantDesc.getHiveObj();
    String principalName = principalDesc == null ? null : principalDesc.getName();
    PrincipalType type = principalDesc == null ? null : principalDesc.getType();
    List<HiveObjectPrivilege> privs = new ArrayList<HiveObjectPrivilege>();
    try {
      if (hiveObjectDesc == null) {
        privs.addAll(db.showPrivilegeGrant(HiveObjectType.GLOBAL, principalName, type,
            null, null, null, null));
View Full Code Here

      } else {
        Map<String, String> params = null;
        if(descDatabase.isExt()) {
          params = database.getParameters();
        }
        PrincipalType ownerType = database.getOwnerType();
        formatter.showDatabaseDescription(outStream, database.getName(),
            database.getDescription(), database.getLocationUri(),
            database.getOwnerName(), (null == ownerType) ? null : ownerType.name(), params);
      }
      outStream.close();
      outStream = null;
    } catch (IOException e) {
      throw new HiveException(e, ErrorMsg.GENERIC_ERROR);
View Full Code Here

    }

    PrincipalDesc principalDesc = showGrantDesc.getPrincipalDesc();
    PrivilegeObjectDesc hiveObjectDesc = showGrantDesc.getHiveObj();
    String principalName = principalDesc == null ? null : principalDesc.getName();
    PrincipalType type = principalDesc == null ? null : principalDesc.getType();
    List<HiveObjectPrivilege> privs = new ArrayList<HiveObjectPrivilege>();
    try {
      if (hiveObjectDesc == null) {
        privs.addAll(db.showPrivilegeGrant(HiveObjectType.GLOBAL, principalName, type,
            null, null, null, null));
View Full Code Here

      } else {
        Map<String, String> params = null;
        if(descDatabase.isExt()) {
          params = database.getParameters();
        }
        PrincipalType ownerType = database.getOwnerType();
        formatter.showDatabaseDescription(outStream, database.getName(),
            database.getDescription(), database.getLocationUri(),
            database.getOwnerName(), (null == ownerType) ? null : ownerType.name(), params);
      }
      outStream.close();
      outStream = null;
    } catch (IOException e) {
      throw new HiveException(e, ErrorMsg.GENERIC_ERROR);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.metastore.api.PrincipalType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.