Package org.apache.hadoop.hive.ql.security.authorization.plugin

Examples of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrincipal


          getHivePrincipal(showGrantDesc.getPrincipalDesc()),
          getHivePrivilegeObject(showGrantDesc.getHiveObj())
          );
      List<HiveObjectPrivilege> privList = new ArrayList<HiveObjectPrivilege>();
      for(HivePrivilegeInfo privInfo : privInfos){
        HivePrincipal principal = privInfo.getPrincipal();
        HivePrivilegeObject privObj = privInfo.getObject();
        HivePrivilege priv = privInfo.getPrivilege();

        PrivilegeGrantInfo grantInfo =
            AuthorizationUtils.getThriftPrivilegeGrantInfo(priv, privInfo.getGrantorPrincipal(),
                privInfo.isGrantOption(), privInfo.getGrantTime());

        //only grantInfo is used
        HiveObjectPrivilege thriftObjectPriv = new HiveObjectPrivilege(new HiveObjectRef(
            AuthorizationUtils.getThriftHiveObjType(privObj.getType()),privObj.getDbname(),
            privObj.getTableViewURI(),null,null), principal.getName(),
            AuthorizationUtils.getThriftPrincipalType(principal.getType()), grantInfo);
        privList.add(thriftObjectPriv);
      }
      boolean testMode = conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST);
      writeToFile(writeGrantInfo(privList, testMode), showGrantDesc.getResFile());
    } catch (IOException e) {
View Full Code Here


    //Convert to object types used by the authorization plugin interface
    List<HivePrincipal> hivePrincipals = getHivePrincipals(principals);
    List<HivePrivilege> hivePrivileges = getHivePrivileges(privileges);
    HivePrivilegeObject hivePrivObject = getHivePrivilegeObject(privSubjectDesc);
    HivePrincipal grantorPrincipal = new HivePrincipal(grantor, getHivePrincipalType(grantorType));

    if(isGrant){
      authorizer.grantPrivileges(hivePrincipals, hivePrivileges, hivePrivObject,
          grantorPrincipal, grantOption);
    }else {
View Full Code Here

  private HivePrincipal getHivePrincipal(PrincipalDesc principal) throws HiveException {
    if (principal == null) {
      return null;
    }
    return new HivePrincipal(principal.getName(),
        AuthorizationUtils.getHivePrincipalType(principal.getType()));
  }
View Full Code Here

      authorizer.dropRole(roleDDLDesc.getName());
      break;
    case SHOW_ROLE_GRANT:
      boolean testMode = conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST);
      List<HiveRoleGrant> roles = authorizer.getRoleGrantInfoForPrincipal(
          new HivePrincipal(roleDDLDesc.getName(), getHivePrincipalType(roleDDLDesc.getPrincipalType())));
      writeToFile(writeRolesGrantedInfo(roles, testMode), roleDDLDesc.getResFile());
      break;
    case SHOW_ROLES:
      List<String> allRoles = authorizer.getAllRoles();
      writeListToFileAfterSort(allRoles, roleDDLDesc.getResFile());
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrincipal

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.