Tabnine Logo
RolePrincipalGrant.getRoleName
Code IndexAdd Tabnine to your IDE (free)

How to use
getRoleName
method
in
org.apache.hadoop.hive.metastore.api.RolePrincipalGrant

Best Java code snippets using org.apache.hadoop.hive.metastore.api.RolePrincipalGrant.getRoleName (Showing top 16 results out of 315)

origin: apache/hive

/**
 * Add role names of parentRoles and its parents to processedRolesMap
 *
 * @param processedRolesMap
 * @param roleGrants
 * @throws TException
 * @throws HiveAuthzPluginException
 * @throws MetaException
 */
private void getAllRoleAncestors(Map<String, HiveRoleGrant> processedRolesMap, List<RolePrincipalGrant> roleGrants)
  throws MetaException, HiveAuthzPluginException, TException {
 for (RolePrincipalGrant parentRoleGrant : roleGrants) {
  String parentRoleName = parentRoleGrant.getRoleName();
  if (processedRolesMap.get(parentRoleName) == null) {
   // unprocessed role: get its parents, add it to processed, and call this
   // function recursively
   List<RolePrincipalGrant> nextParentRoles = getRoleGrants(parentRoleName, PrincipalType.ROLE);
   processedRolesMap.put(parentRoleName, new HiveRoleGrant(parentRoleGrant));
   getAllRoleAncestors(processedRolesMap, nextParentRoles);
  }
 }
}
origin: apache/drill

/**
 * Add role names of parentRoles and its parents to processedRolesMap
 *
 * @param processedRolesMap
 * @param roleGrants
 * @throws TException
 * @throws HiveAuthzPluginException
 * @throws MetaException
 */
private void getAllRoleAncestors(Map<String, HiveRoleGrant> processedRolesMap, List<RolePrincipalGrant> roleGrants)
  throws MetaException, HiveAuthzPluginException, TException {
 for (RolePrincipalGrant parentRoleGrant : roleGrants) {
  String parentRoleName = parentRoleGrant.getRoleName();
  if (processedRolesMap.get(parentRoleName) == null) {
   // unprocessed role: get its parents, add it to processed, and call this
   // function recursively
   List<RolePrincipalGrant> nextParentRoles = getRoleGrants(parentRoleName, PrincipalType.ROLE);
   processedRolesMap.put(parentRoleName, new HiveRoleGrant(parentRoleGrant));
   getAllRoleAncestors(processedRolesMap, nextParentRoles);
  }
 }
}
origin: apache/hive

static String writeRoleGrantsInfo(List<RolePrincipalGrant> roleGrants, boolean testMode) {
 if (roleGrants == null || roleGrants.isEmpty()) {
  return "";
 }
 StringBuilder builder = new StringBuilder();
 //sort the list to get sorted (deterministic) output (for ease of testing)
 Collections.sort(roleGrants);
 for (RolePrincipalGrant roleGrant : roleGrants) {
  appendNonNull(builder, roleGrant.getRoleName(), true);
  appendNonNull(builder, roleGrant.isGrantOption());
  appendNonNull(builder, testMode ? -1 : roleGrant.getGrantTime() * 1000L);
  appendNonNull(builder, roleGrant.getGrantorName());
 }
 return builder.toString();
}
origin: apache/drill

static String writeRoleGrantsInfo(List<RolePrincipalGrant> roleGrants, boolean testMode) {
 if (roleGrants == null || roleGrants.isEmpty()) {
  return "";
 }
 StringBuilder builder = new StringBuilder();
 //sort the list to get sorted (deterministic) output (for ease of testing)
 Collections.sort(roleGrants);
 for (RolePrincipalGrant roleGrant : roleGrants) {
  appendNonNull(builder, roleGrant.getRoleName(), true);
  appendNonNull(builder, roleGrant.isGrantOption());
  appendNonNull(builder, testMode ? -1 : roleGrant.getGrantTime() * 1000L);
  appendNonNull(builder, roleGrant.getGrantorName());
 }
 return builder.toString();
}
origin: apache/hive

public Object getFieldValue(_Fields field) {
 switch (field) {
 case ROLE_NAME:
  return getRoleName();
 case PRINCIPAL_NAME:
  return getPrincipalName();
 case PRINCIPAL_TYPE:
  return getPrincipalType();
 case GRANT_OPTION:
  return isGrantOption();
 case GRANT_TIME:
  return getGrantTime();
 case GRANTOR_NAME:
  return getGrantorName();
 case GRANTOR_PRINCIPAL_TYPE:
  return getGrantorPrincipalType();
 }
 throw new IllegalStateException();
}
origin: apache/hive

public HiveRoleGrant(RolePrincipalGrant thriftRoleGrant) {
 this.roleName = thriftRoleGrant.getRoleName();
 this.principalName = thriftRoleGrant.getPrincipalName();
 this.principalType = thriftRoleGrant.getPrincipalType().name();
 this.grantOption = thriftRoleGrant.isGrantOption();
 this.grantTime = thriftRoleGrant.getGrantTime();
 this.grantor = thriftRoleGrant.getGrantorName();
 this.grantorType = thriftRoleGrant.getGrantorPrincipalType() == null ? null :
  thriftRoleGrant.getGrantorPrincipalType().name();
}
origin: apache/drill

public HiveRoleGrant(RolePrincipalGrant thriftRoleGrant) {
 this.roleName = thriftRoleGrant.getRoleName();
 this.principalName = thriftRoleGrant.getPrincipalName();
 this.principalType = thriftRoleGrant.getPrincipalType().name();
 this.grantOption = thriftRoleGrant.isGrantOption();
 this.grantTime = thriftRoleGrant.getGrantTime();
 this.grantor = thriftRoleGrant.getGrantorName();
 this.grantorType = thriftRoleGrant.getGrantorPrincipalType() == null ? null :
  thriftRoleGrant.getGrantorPrincipalType().name();
}
origin: com.facebook.presto.hive/hive-apache

/**
 * Add role names of parentRoles and its parents to processedRolesMap
 *
 * @param processedRolesMap
 * @param roleGrants
 * @throws TException
 * @throws HiveAuthzPluginException
 * @throws MetaException
 */
private void getAllRoleAncestors(Map<String, HiveRoleGrant> processedRolesMap, List<RolePrincipalGrant> roleGrants)
  throws MetaException, HiveAuthzPluginException, TException {
 for (RolePrincipalGrant parentRoleGrant : roleGrants) {
  String parentRoleName = parentRoleGrant.getRoleName();
  if (processedRolesMap.get(parentRoleName) == null) {
   // unprocessed role: get its parents, add it to processed, and call this
   // function recursively
   List<RolePrincipalGrant> nextParentRoles = getRoleGrants(parentRoleName, PrincipalType.ROLE);
   processedRolesMap.put(parentRoleName, new HiveRoleGrant(parentRoleGrant));
   getAllRoleAncestors(processedRolesMap, nextParentRoles);
  }
 }
}
origin: prestosql/presto

@Override
public void revokeRole(String role, String granteeName, PrincipalType granteeType, boolean grantOption)
    throws TException
{
  List<RolePrincipalGrant> grants = listRoleGrants(granteeName, granteeType);
  RolePrincipalGrant currentGrant = null;
  for (RolePrincipalGrant grant : grants) {
    if (grant.getRoleName().equals(role)) {
      currentGrant = grant;
      break;
    }
  }
  if (currentGrant == null) {
    return;
  }
  if (!currentGrant.isGrantOption() && grantOption) {
    return;
  }
  removeGrant(role, granteeName, granteeType, grantOption);
}
origin: com.facebook.presto.hive/hive-apache

static String writeRoleGrantsInfo(List<RolePrincipalGrant> roleGrants, boolean testMode) {
 if (roleGrants == null || roleGrants.isEmpty()) {
  return "";
 }
 StringBuilder builder = new StringBuilder();
 //sort the list to get sorted (deterministic) output (for ease of testing)
 Collections.sort(roleGrants);
 for (RolePrincipalGrant roleGrant : roleGrants) {
  appendNonNull(builder, roleGrant.getRoleName(), true);
  appendNonNull(builder, roleGrant.isGrantOption());
  appendNonNull(builder, testMode ? -1 : roleGrant.getGrantTime() * 1000L);
  appendNonNull(builder, roleGrant.getGrantorName());
 }
 return builder.toString();
}
origin: com.facebook.presto.hive/hive-apache

public Object getFieldValue(_Fields field) {
 switch (field) {
 case ROLE_NAME:
  return getRoleName();
 case PRINCIPAL_NAME:
  return getPrincipalName();
 case PRINCIPAL_TYPE:
  return getPrincipalType();
 case GRANT_OPTION:
  return Boolean.valueOf(isGrantOption());
 case GRANT_TIME:
  return Integer.valueOf(getGrantTime());
 case GRANTOR_NAME:
  return getGrantorName();
 case GRANTOR_PRINCIPAL_TYPE:
  return getGrantorPrincipalType();
 }
 throw new IllegalStateException();
}
origin: org.spark-project.hive/hive-metastore

public Object getFieldValue(_Fields field) {
 switch (field) {
 case ROLE_NAME:
  return getRoleName();
 case PRINCIPAL_NAME:
  return getPrincipalName();
 case PRINCIPAL_TYPE:
  return getPrincipalType();
 case GRANT_OPTION:
  return Boolean.valueOf(isGrantOption());
 case GRANT_TIME:
  return Integer.valueOf(getGrantTime());
 case GRANTOR_NAME:
  return getGrantorName();
 case GRANTOR_PRINCIPAL_TYPE:
  return getGrantorPrincipalType();
 }
 throw new IllegalStateException();
}
origin: prestosql/presto

@Override
public void grantRole(String role, String granteeName, PrincipalType granteeType, String grantorName, PrincipalType grantorType, boolean grantOption)
    throws TException
{
  List<RolePrincipalGrant> grants = listRoleGrants(granteeName, granteeType);
  for (RolePrincipalGrant grant : grants) {
    if (grant.getRoleName().equals(role)) {
      if (grant.isGrantOption() == grantOption) {
        return;
      }
      if (!grant.isGrantOption() && grantOption) {
        revokeRole(role, granteeName, granteeType, false);
        break;
      }
    }
  }
  createGrant(role, granteeName, granteeType, grantorName, grantorType, grantOption);
}
origin: org.apache.hive/hive-standalone-metastore

public Object getFieldValue(_Fields field) {
 switch (field) {
 case ROLE_NAME:
  return getRoleName();
 case PRINCIPAL_NAME:
  return getPrincipalName();
 case PRINCIPAL_TYPE:
  return getPrincipalType();
 case GRANT_OPTION:
  return isGrantOption();
 case GRANT_TIME:
  return getGrantTime();
 case GRANTOR_NAME:
  return getGrantorName();
 case GRANTOR_PRINCIPAL_TYPE:
  return getGrantorPrincipalType();
 }
 throw new IllegalStateException();
}
origin: prestosql/presto

public static RoleGrant fromRolePrincipalGrant(RolePrincipalGrant grant)
{
  return new RoleGrant(
      new PrestoPrincipal(fromMetastoreApiPrincipalType(grant.getPrincipalType()), grant.getPrincipalName()),
      grant.getRoleName(),
      grant.isGrantOption());
}
origin: com.facebook.presto.hive/hive-apache

public HiveRoleGrant(RolePrincipalGrant thriftRoleGrant) {
 this.roleName = thriftRoleGrant.getRoleName();
 this.principalName = thriftRoleGrant.getPrincipalName();
 this.principalType = thriftRoleGrant.getPrincipalType().name();
 this.grantOption = thriftRoleGrant.isGrantOption();
 this.grantTime = thriftRoleGrant.getGrantTime();
 this.grantor = thriftRoleGrant.getGrantorName();
 this.grantorType = thriftRoleGrant.getGrantorPrincipalType() == null ? null :
  thriftRoleGrant.getGrantorPrincipalType().name();
}
org.apache.hadoop.hive.metastore.apiRolePrincipalGrantgetRoleName

Popular methods of RolePrincipalGrant

  • getPrincipalName
  • getPrincipalType
  • isGrantOption
  • getGrantTime
  • getGrantorName
  • getGrantorPrincipalType
  • <init>
    Performs a deep copy on other.
  • equals
  • isSetGrantOption
    Returns true if field grantOption is set (has been assigned a value) and false otherwise
  • isSetGrantTime
    Returns true if field grantTime is set (has been assigned a value) and false otherwise
  • isSetGrantorName
    Returns true if field grantorName is set (has been assigned a value) and false otherwise
  • isSetGrantorPrincipalType
    Returns true if field grantorPrincipalType is set (has been assigned a value) and false otherwise
  • isSetGrantorName,
  • isSetGrantorPrincipalType,
  • isSetPrincipalName,
  • isSetPrincipalType,
  • isSetRoleName,
  • read,
  • setGrantOption,
  • setGrantOptionIsSet,
  • setGrantTime

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • addToBackStack (FragmentTransaction)
  • runOnUiThread (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now