Codota Logo
TSentryPrivilege.getGrantOption
Code IndexAdd Codota to your IDE (free)

How to use
getGrantOption
method
in
org.apache.sentry.provider.db.service.thrift.TSentryPrivilege

Best Java code snippets using org.apache.sentry.provider.db.service.thrift.TSentryPrivilege.getGrantOption (Showing top 11 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: apache/incubator-sentry

String uri = tSentryPrivilege.getURI();
String action = tSentryPrivilege.getAction();
String grantOption = (tSentryPrivilege.getGrantOption() == TSentryGrantOption.TRUE ? "true"
  : "false");
if (!StringUtils.isEmpty(serverName)) {
origin: apache/incubator-sentry

String uri = tSentryPrivilege.getURI();
String action = tSentryPrivilege.getAction();
String grantOption = (tSentryPrivilege.getGrantOption() == TSentryGrantOption.TRUE ? "true"
    : "false");
if (!StringUtils.isEmpty(serverName)) {
origin: apache/incubator-sentry

if (privilege.getGrantOption() == TSentryGrantOption.TRUE) {
 sb.append(" WITH GRANT OPTION");
origin: apache/incubator-sentry

public Object getFieldValue(_Fields field) {
 switch (field) {
 case PRIVILEGE_SCOPE:
  return getPrivilegeScope();
 case SERVER_NAME:
  return getServerName();
 case DB_NAME:
  return getDbName();
 case TABLE_NAME:
  return getTableName();
 case URI:
  return getURI();
 case ACTION:
  return getAction();
 case CREATE_TIME:
  return Long.valueOf(getCreateTime());
 case GRANT_OPTION:
  return getGrantOption();
 case COLUMN_NAME:
  return getColumnName();
 }
 throw new IllegalStateException();
}
origin: apache/incubator-sentry

static String writeGrantInfo(Set<TSentryPrivilege> privileges, String roleName) {
 if (privileges == null || privileges.isEmpty()) {
  return "";
 }
 StringBuilder builder = new StringBuilder();
 for (TSentryPrivilege privilege : privileges) {
  if (PrivilegeScope.URI.name().equalsIgnoreCase(
    privilege.getPrivilegeScope())) {
   appendNonNull(builder, privilege.getURI(), true);
  } else if(PrivilegeScope.SERVER.name().equalsIgnoreCase(
    privilege.getPrivilegeScope())) {
   appendNonNull(builder, "*", true);//Db column would show * if it is a server level privilege
  } else {
   appendNonNull(builder, privilege.getDbName(), true);
  }
  appendNonNull(builder, privilege.getTableName());
  appendNonNull(builder, null);//getPartValues()
  appendNonNull(builder, privilege.getColumnName());//getColumnName()
  appendNonNull(builder, roleName);//getPrincipalName()
  appendNonNull(builder, "ROLE");//getPrincipalType()
  appendNonNull(builder, privilege.getAction());
  appendNonNull(builder,
    TSentryGrantOption.TRUE.equals(privilege.getGrantOption()));
  appendNonNull(builder, privilege.getCreateTime() * 1000L);
  appendNonNull(builder, "--");
 }
 LOG.info("builder.toString(): " + builder.toString());
 return builder.toString();
}
origin: apache/incubator-sentry

@Override
public void execute(SentryPolicyServiceClient client, String requestorName) throws Exception {
 TSentryPrivilege tSentryPrivilege = CommandUtil.convertToTSentryPrivilege(privilegeStr);
 boolean grantOption = tSentryPrivilege.getGrantOption().equals(TSentryGrantOption.TRUE) ? true : false;
 if (ServiceConstants.PrivilegeScope.SERVER.toString().equals(tSentryPrivilege.getPrivilegeScope())) {
  client.revokeServerPrivilege(requestorName, roleName, tSentryPrivilege.getServerName(),
      grantOption);
 } else if (ServiceConstants.PrivilegeScope.DATABASE.toString().equals(tSentryPrivilege.getPrivilegeScope())) {
  client.revokeDatabasePrivilege(requestorName, roleName, tSentryPrivilege.getServerName(),
      tSentryPrivilege.getDbName(), tSentryPrivilege.getAction(), grantOption);
 } else if (ServiceConstants.PrivilegeScope.TABLE.toString().equals(tSentryPrivilege.getPrivilegeScope())) {
  client.revokeTablePrivilege(requestorName, roleName, tSentryPrivilege.getServerName(),
      tSentryPrivilege.getDbName(), tSentryPrivilege.getTableName(),
      tSentryPrivilege.getAction(), grantOption);
 } else if (ServiceConstants.PrivilegeScope.COLUMN.toString().equals(tSentryPrivilege.getPrivilegeScope())) {
  client.revokeColumnPrivilege(requestorName, roleName, tSentryPrivilege.getServerName(),
      tSentryPrivilege.getDbName(), tSentryPrivilege.getTableName(),
      tSentryPrivilege.getColumnName(), tSentryPrivilege.getAction(), grantOption);
 } else if (ServiceConstants.PrivilegeScope.URI.toString().equals(tSentryPrivilege.getPrivilegeScope())) {
  client.revokeURIPrivilege(requestorName, roleName, tSentryPrivilege.getServerName(),
      tSentryPrivilege.getURI(), grantOption);
 }
}
origin: apache/incubator-sentry

 @Override
 public void execute(SentryPolicyServiceClient client, String requestorName) throws Exception {
  TSentryPrivilege tSentryPrivilege = CommandUtil.convertToTSentryPrivilege(privilegeStr);
  boolean grantOption = tSentryPrivilege.getGrantOption().equals(TSentryGrantOption.TRUE) ? true : false;
  if (ServiceConstants.PrivilegeScope.SERVER.toString().equals(tSentryPrivilege.getPrivilegeScope())) {
   client.grantServerPrivilege(requestorName, roleName, tSentryPrivilege.getServerName(),
       tSentryPrivilege.getAction(), grantOption);
  } else if (ServiceConstants.PrivilegeScope.DATABASE.toString().equals(tSentryPrivilege.getPrivilegeScope())) {
   client.grantDatabasePrivilege(requestorName, roleName, tSentryPrivilege.getServerName(),
       tSentryPrivilege.getDbName(), tSentryPrivilege.getAction(), grantOption);
  } else if (ServiceConstants.PrivilegeScope.TABLE.toString().equals(tSentryPrivilege.getPrivilegeScope())) {
   client.grantTablePrivilege(requestorName, roleName, tSentryPrivilege.getServerName(),
       tSentryPrivilege.getDbName(), tSentryPrivilege.getTableName(),
       tSentryPrivilege.getAction(), grantOption);
  } else if (ServiceConstants.PrivilegeScope.COLUMN.toString().equals(tSentryPrivilege.getPrivilegeScope())) {
   client.grantColumnPrivilege(requestorName, roleName, tSentryPrivilege.getServerName(),
       tSentryPrivilege.getDbName(), tSentryPrivilege.getTableName(),
       tSentryPrivilege.getColumnName(), tSentryPrivilege.getAction(), grantOption);
  } else if (ServiceConstants.PrivilegeScope.URI.toString().equals(tSentryPrivilege.getPrivilegeScope())) {
   client.grantURIPrivilege(requestorName, roleName, tSentryPrivilege.getServerName(),
       tSentryPrivilege.getURI(), grantOption);
  }
 }
}
origin: apache/incubator-sentry

/**
 * Converts thrift object to model object. Additionally does normalization
 * such as trimming whitespace and setting appropriate case.
 * @throws SentryInvalidInputException
 */
private MSentryPrivilege convertToMSentryPrivilege(TSentryPrivilege privilege)
  throws SentryInvalidInputException {
 MSentryPrivilege mSentryPrivilege = new MSentryPrivilege();
 mSentryPrivilege.setServerName(toNULLCol(safeTrimLower(privilege.getServerName())));
 mSentryPrivilege.setDbName(toNULLCol(safeTrimLower(privilege.getDbName())));
 mSentryPrivilege.setTableName(toNULLCol(safeTrimLower(privilege.getTableName())));
 mSentryPrivilege.setColumnName(toNULLCol(safeTrimLower(privilege.getColumnName())));
 mSentryPrivilege.setPrivilegeScope(safeTrim(privilege.getPrivilegeScope()));
 mSentryPrivilege.setAction(toNULLCol(safeTrimLower(privilege.getAction())));
 mSentryPrivilege.setCreateTime(System.currentTimeMillis());
 mSentryPrivilege.setURI(toNULLCol(safeTrim(privilege.getURI())));
 if ( !privilege.getGrantOption().equals(TSentryGrantOption.UNSET) ) {
  mSentryPrivilege.setGrantOption(Boolean.valueOf(privilege.getGrantOption().toString()));
 } else {
  mSentryPrivilege.setGrantOption(null);
 }
 return mSentryPrivilege;
}
private static String safeTrim(String s) {
origin: apache/incubator-sentry

private MSentryPrivilege getMSentryPrivilege(TSentryPrivilege tPriv, PersistenceManager pm) {
 Query query = pm.newQuery(MSentryPrivilege.class);
 query.setFilter("this.serverName == \"" + toNULLCol(safeTrimLower(tPriv.getServerName())) + "\" "
   + "&& this.dbName == \"" + toNULLCol(safeTrimLower(tPriv.getDbName())) + "\" "
   + "&& this.tableName == \"" + toNULLCol(safeTrimLower(tPriv.getTableName())) + "\" "
   + "&& this.columnName == \"" + toNULLCol(safeTrimLower(tPriv.getColumnName())) + "\" "
   + "&& this.URI == \"" + toNULLCol(safeTrim(tPriv.getURI())) + "\" "
   + "&& this.grantOption == grantOption "
   + "&& this.action == \"" + toNULLCol(safeTrimLower(tPriv.getAction())) + "\"");
 query.declareParameters("Boolean grantOption");
 query.setUnique(true);
 Boolean grantOption = null;
 if (tPriv.getGrantOption().equals(TSentryGrantOption.TRUE)) {
  grantOption = true;
 } else if (tPriv.getGrantOption().equals(TSentryGrantOption.FALSE)) {
  grantOption = false;
 }
 Object obj = query.execute(grantOption);
 if (obj != null) {
  return (MSentryPrivilege) obj;
 }
 return null;
}
origin: apache/incubator-sentry

 return false;
if (!tSentryPrivilege1.getGrantOption().equals(tSentryPrivilege2.getGrantOption())) {
 return false;
origin: apache/incubator-sentry

Set<MSentryPrivilege> privileges = role.getPrivileges();
assertEquals(privileges.toString(), 1, privileges.size());
assertEquals(Boolean.valueOf(privilege.getGrantOption().toString()), Iterables.get(privileges, 0).getGrantOption());
assertEquals(seqId + 2, sentryStore.alterSentryRoleRevokePrivilege(grantor, roleName, privilege)
  .getSequenceId());
org.apache.sentry.provider.db.service.thriftTSentryPrivilegegetGrantOption

Popular methods of TSentryPrivilege

  • getAction
  • getDbName
  • getPrivilegeScope
  • getTableName
  • getColumnName
  • getURI
  • <init>
    Performs a deep copy on other.
  • getCreateTime
  • getServerName
  • isSetAction
    Returns true if field action is set (has been assigned a value) and false otherwise
  • isSetColumnName
    Returns true if field columnName is set (has been assigned a value) and false otherwise
  • isSetDbName
    Returns true if field dbName is set (has been assigned a value) and false otherwise
  • isSetColumnName,
  • isSetDbName,
  • isSetGrantOption,
  • isSetPrivilegeScope,
  • isSetServerName,
  • isSetTableName,
  • isSetURI,
  • setAction,
  • setColumnName

Popular in Java

  • Reading from database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • addToBackStack (FragmentTransaction)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now