congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TSentryPrivilege.setAction
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: apache/incubator-sentry

public static TSentryPrivilege convertToTSentryPrivilege(String privilegeStr) {
 TSentryPrivilege tSentryPrivilege = new TSentryPrivilege();
 for (String authorizable : PolicyConstants.AUTHORIZABLE_SPLITTER.split(privilegeStr)) {
  KeyValue tempKV = new KeyValue(authorizable);
  String key = tempKV.getKey();
  String value = tempKV.getValue();
  if (PolicyFileConstants.PRIVILEGE_SERVER_NAME.equalsIgnoreCase(key)) {
   tSentryPrivilege.setServerName(value);
  } else if (PolicyFileConstants.PRIVILEGE_DATABASE_NAME.equalsIgnoreCase(key)) {
   tSentryPrivilege.setDbName(value);
  } else if (PolicyFileConstants.PRIVILEGE_TABLE_NAME.equalsIgnoreCase(key)) {
   tSentryPrivilege.setTableName(value);
  } else if (PolicyFileConstants.PRIVILEGE_COLUMN_NAME.equalsIgnoreCase(key)) {
   tSentryPrivilege.setColumnName(value);
  } else if (PolicyFileConstants.PRIVILEGE_URI_NAME.equalsIgnoreCase(key)) {
   tSentryPrivilege.setURI(value);
  } else if (PolicyFileConstants.PRIVILEGE_ACTION_NAME.equalsIgnoreCase(key)) {
   tSentryPrivilege.setAction(value);
  } else if (PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME.equalsIgnoreCase(key)) {
   TSentryGrantOption grantOption = "true".equalsIgnoreCase(value) ? TSentryGrantOption.TRUE
     : TSentryGrantOption.FALSE;
   tSentryPrivilege.setGrantOption(grantOption);
  }
 }
 tSentryPrivilege.setPrivilegeScope(getPrivilegeScope(tSentryPrivilege));
 return tSentryPrivilege;
}
origin: apache/incubator-sentry

public static TSentryPrivilege convertToTSentryPrivilege(String privilegeStr) throws Exception {
 TSentryPrivilege tSentryPrivilege = new TSentryPrivilege();
 for (String authorizable : PolicyConstants.AUTHORIZABLE_SPLITTER.split(privilegeStr)) {
  KeyValue tempKV = new KeyValue(authorizable);
  String key = tempKV.getKey();
  String value = tempKV.getValue();
  if (PolicyFileConstants.PRIVILEGE_SERVER_NAME.equalsIgnoreCase(key)) {
   tSentryPrivilege.setServerName(value);
  } else if (PolicyFileConstants.PRIVILEGE_DATABASE_NAME.equalsIgnoreCase(key)) {
   tSentryPrivilege.setDbName(value);
  } else if (PolicyFileConstants.PRIVILEGE_TABLE_NAME.equalsIgnoreCase(key)) {
   tSentryPrivilege.setTableName(value);
  } else if (PolicyFileConstants.PRIVILEGE_COLUMN_NAME.equalsIgnoreCase(key)) {
   tSentryPrivilege.setColumnName(value);
  } else if (PolicyFileConstants.PRIVILEGE_URI_NAME.equalsIgnoreCase(key)) {
   tSentryPrivilege.setURI(value);
  } else if (PolicyFileConstants.PRIVILEGE_ACTION_NAME.equalsIgnoreCase(key)) {
   tSentryPrivilege.setAction(value);
  } else if (PolicyFileConstants.PRIVILEGE_GRANT_OPTION_NAME.equalsIgnoreCase(key)) {
   TSentryGrantOption grantOption = "true".equalsIgnoreCase(value) ? TSentryGrantOption.TRUE
       : TSentryGrantOption.FALSE;
   tSentryPrivilege.setGrantOption(grantOption);
  }
 }
 tSentryPrivilege.setPrivilegeScope(getPrivilegeScope(tSentryPrivilege));
 validatePrivilegeHierarchy(tSentryPrivilege);
 return tSentryPrivilege;
}
origin: apache/incubator-sentry

private Set<TSentryPrivilege> convertColumnPrivilege(
  PrivilegeScope scope, String serverName, String uri, String db, String table, String column,
  String action, Boolean grantOption) {
 ImmutableSet.Builder<TSentryPrivilege> setBuilder = ImmutableSet.builder();
 TSentryPrivilege privilege = new TSentryPrivilege();
 privilege.setPrivilegeScope(scope.toString());
 privilege.setServerName(serverName);
 privilege.setURI(uri);
 privilege.setDbName(db);
 privilege.setTableName(table);
 privilege.setColumnName(column);
 privilege.setAction(action);
 privilege.setCreateTime(System.currentTimeMillis());
 privilege.setGrantOption(convertTSentryGrantOption(grantOption));
 setBuilder.add(privilege);
 return setBuilder.build();
}
origin: apache/incubator-sentry

privilege.setTableName(table);
privilege.setColumnName(null);
privilege.setAction(action);
privilege.setCreateTime(System.currentTimeMillis());
privilege.setGrantOption(convertTSentryGrantOption(grantOption));
 privilege.setTableName(table);
 privilege.setColumnName(column);
 privilege.setAction(action);
 privilege.setCreateTime(System.currentTimeMillis());
 privilege.setGrantOption(convertTSentryGrantOption(grantOption));
origin: apache/incubator-sentry

tPrivilege.setAction(privilegeAction);
newPrivilege.setAction(privilegeAction);
renamePrivilegeForAllRoles(pm, tPrivilege, newPrivilege);
origin: apache/incubator-sentry

private TSentryPrivilege getPrivilege(String action, String privilegeScope,
  String dbName, String tableName, String serverName, String URI) {
 TSentryPrivilege privilege = new TSentryPrivilege();
 privilege.setAction(action);
 privilege.setPrivilegeScope(privilegeScope);
 privilege.setDbName(dbName);
 privilege.setTableName(tableName);
 privilege.setServerName(serverName);
 privilege.setURI(URI);
 return privilege;
}
origin: apache/incubator-sentry

private TSentryPrivilege getPrivilege(String action, String privilegeScope,
  String dbName, String tableName, String serverName, String URI) {
 TSentryPrivilege privilege = new TSentryPrivilege();
 privilege.setAction(action);
 privilege.setPrivilegeScope(privilegeScope);
 privilege.setDbName(dbName);
 privilege.setTableName(tableName);
 privilege.setServerName(serverName);
 privilege.setURI(URI);
 return privilege;
}
origin: apache/incubator-sentry

private void convertToTSentryPrivilege(MSentryPrivilege mSentryPrivilege,
  TSentryPrivilege privilege) {
 privilege.setCreateTime(mSentryPrivilege.getCreateTime());
 privilege.setAction(fromNULLCol(mSentryPrivilege.getAction()));
 privilege.setPrivilegeScope(mSentryPrivilege.getPrivilegeScope());
 privilege.setServerName(fromNULLCol(mSentryPrivilege.getServerName()));
 privilege.setDbName(fromNULLCol(mSentryPrivilege.getDbName()));
 privilege.setTableName(fromNULLCol(mSentryPrivilege.getTableName()));
 privilege.setColumnName(fromNULLCol(mSentryPrivilege.getColumnName()));
 privilege.setURI(fromNULLCol(mSentryPrivilege.getURI()));
 if (mSentryPrivilege.getGrantOption() != null) {
  privilege.setGrantOption(TSentryGrantOption.valueOf(mSentryPrivilege.getGrantOption().toString().toUpperCase()));
 } else {
  privilege.setGrantOption(TSentryGrantOption.UNSET);
 }
}
origin: apache/incubator-sentry

/**
 * Drop given privilege from all roles
 */
public void dropPrivilege(TSentryAuthorizable tAuthorizable)
  throws SentryNoSuchObjectException, SentryInvalidInputException {
 PersistenceManager pm = null;
 boolean rollbackTransaction = true;
 TSentryPrivilege tPrivilege = toSentryPrivilege(tAuthorizable);
 try {
  pm = openTransaction();
  if (isMultiActionsSupported(tPrivilege)) {
   for (String privilegeAction : ALL_ACTIONS) {
    tPrivilege.setAction(privilegeAction);
    dropPrivilegeForAllRoles(pm, new TSentryPrivilege(tPrivilege));
   }
  } else {
   dropPrivilegeForAllRoles(pm, new TSentryPrivilege(tPrivilege));
  }
  rollbackTransaction = false;
  commitTransaction(pm);
 } catch (JDODataStoreException e) {
  throw new SentryInvalidInputException("Failed to get privileges: "
    + e.getMessage());
 } finally {
  if (rollbackTransaction) {
   rollbackTransaction(pm);
  }
 }
}
origin: apache/incubator-sentry

privilege_tbl1_insert.setAction(AccessConstants.INSERT);
privilege_tbl1_select.setAction(AccessConstants.SELECT);
privilege_tbl1_alter.setAction(AccessConstants.ALTER);
privilege_tbl1_drop.setAction(AccessConstants.DROP);
origin: apache/incubator-sentry

@Test
public void testDropOverlappedPrivileges() throws Exception {
 String roleName1 = "list-privs-r1";
 String grantor = "g1";
 sentryStore.createSentryRole(roleName1);
 TSentryPrivilege privilege_tbl1 = new TSentryPrivilege();
 privilege_tbl1.setPrivilegeScope("TABLE");
 privilege_tbl1.setServerName("server1");
 privilege_tbl1.setDbName("db1");
 privilege_tbl1.setTableName("tbl1");
 privilege_tbl1.setCreateTime(System.currentTimeMillis());
 TSentryPrivilege privilege_tbl1_insert = new TSentryPrivilege(
   privilege_tbl1);
 privilege_tbl1_insert.setAction("INSERT");
 TSentryPrivilege privilege_tbl1_all = new TSentryPrivilege(privilege_tbl1);
 privilege_tbl1_all.setAction("*");
 sentryStore.alterSentryRoleGrantPrivilege(grantor, roleName1, privilege_tbl1_insert);
 sentryStore.alterSentryRoleGrantPrivilege(grantor, roleName1, privilege_tbl1_all);
 sentryStore.dropPrivilege(toTSentryAuthorizable(privilege_tbl1));
 assertEquals(0, sentryStore.getAllTSentryPrivilegesByRoleName(roleName1)
   .size());
}
origin: apache/incubator-sentry

private TSentryPrivilege createTSentryPrivilege(String scope, String server, String dbName,
  String tableName, String columnName, String uri, String action, TSentryGrantOption grantOption) {
 TSentryPrivilege tSentryPrivilege = new TSentryPrivilege();
 tSentryPrivilege.setPrivilegeScope(scope);
 tSentryPrivilege.setServerName(server);
 tSentryPrivilege.setDbName(dbName);
 tSentryPrivilege.setTableName(tableName);
 tSentryPrivilege.setColumnName(columnName);
 tSentryPrivilege.setURI(uri);
 tSentryPrivilege.setAction(action);
 tSentryPrivilege.setGrantOption(grantOption);
 return tSentryPrivilege;
}
origin: apache/incubator-sentry

priv.setPrivilegeScope("DATABASE");
priv.setServerName(server);
priv.setAction(AccessConstants.ALL);
priv.setCreateTime(System.currentTimeMillis());
priv.setTableName(table + i);
sentryStore.alterSentryRoleGrantPrivilege(grantor, roleName, priv);
priv.setAction(AccessConstants.SELECT);
priv.setGrantOption(TSentryGrantOption.UNSET);
sentryStore.alterSentryRoleRevokePrivilege(grantor, roleName, priv);
origin: apache/incubator-sentry

privilege.setDbName(db);
privilege.setTableName(table);
privilege.setAction(AccessConstants.ALL);
privilege.setCreateTime(System.currentTimeMillis());
assertEquals(seqId + 1, sentryStore.alterSentryRoleGrantPrivilege(grantor, roleName, privilege)
Set<MSentryPrivilege> privileges = role.getPrivileges();
assertEquals(privileges.toString(), 1, privileges.size());
privilege.setAction(AccessConstants.SELECT);
assertEquals(seqId + 2, sentryStore.alterSentryRoleRevokePrivilege(grantor, roleName, privilege)
  .getSequenceId());
origin: apache/incubator-sentry

privilege_tbl1.setDbName("db1");
privilege_tbl1.setTableName(table1);
privilege_tbl1.setAction(AccessConstants.SELECT);
privilege_tbl1.setCreateTime(System.currentTimeMillis());
origin: apache/incubator-sentry

@Test
public void testCaseInsensitiveRole() throws Exception {
 String roleName = "newRole";
 String grantor = "g1";
 Set<TSentryGroup> groups = Sets.newHashSet();
 TSentryGroup group = new TSentryGroup();
 group.setGroupName("test-groups-g1");
 groups.add(group);
 TSentryPrivilege privilege = new TSentryPrivilege();
 privilege.setPrivilegeScope("TABLE");
 privilege.setServerName("server1");
 privilege.setDbName("default");
 privilege.setTableName("table1");
 privilege.setAction(AccessConstants.ALL);
 privilege.setCreateTime(System.currentTimeMillis());
 long seqId = sentryStore.createSentryRole(roleName).getSequenceId();
 assertEquals(seqId + 1, sentryStore.alterSentryRoleAddGroups(grantor, roleName, groups).getSequenceId());
 assertEquals(seqId + 2, sentryStore.alterSentryRoleDeleteGroups(roleName, groups).getSequenceId());
 assertEquals(seqId + 3, sentryStore.alterSentryRoleGrantPrivilege(grantor, roleName, privilege).getSequenceId());
 assertEquals(seqId + 4, sentryStore.alterSentryRoleRevokePrivilege(grantor, roleName, privilege).getSequenceId());
}
@Test
origin: apache/incubator-sentry

privilege_tbl1.setDbName("db1");
privilege_tbl1.setTableName(table1);
privilege_tbl1.setAction(AccessConstants.SELECT);
privilege_tbl1.setCreateTime(System.currentTimeMillis());
origin: apache/incubator-sentry

@Test
public void testGrantDuplicatePrivilege() throws Exception {
 String roleName = "test-privilege";
 String grantor = "g1";
 String server = "server1";
 String db = "db1";
 String table = "tbl1";
 long seqId = sentryStore.createSentryRole(roleName).getSequenceId();
 TSentryPrivilege privilege = new TSentryPrivilege();
 privilege.setPrivilegeScope("TABLE");
 privilege.setServerName(server);
 privilege.setDbName(db);
 privilege.setTableName(table);
 privilege.setAction(AccessConstants.ALL);
 privilege.setCreateTime(System.currentTimeMillis());
 assertEquals(seqId + 1, sentryStore.alterSentryRoleGrantPrivilege(grantor, roleName, privilege)
   .getSequenceId());
 assertEquals(seqId + 2, sentryStore.alterSentryRoleGrantPrivilege(grantor, roleName, privilege)
   .getSequenceId());
 privilege.setServerName("Server1");
 privilege.setDbName("DB1");
 privilege.setTableName("TBL1");
 assertEquals(seqId + 3, sentryStore.alterSentryRoleGrantPrivilege(grantor, roleName, privilege)
   .getSequenceId());
 MSentryRole role = sentryStore.getMSentryRoleByName(roleName);
 Set<MSentryPrivilege> privileges = role.getPrivileges();
 assertEquals(privileges.toString(), 1, privileges.size());
}
origin: apache/incubator-sentry

priv.setPrivilegeScope("TABLE");
priv.setServerName(server);
priv.setAction(AccessConstants.ALL);
priv.setCreateTime(System.currentTimeMillis());
priv.setTableName(table + i);
origin: apache/incubator-sentry

private TSentryPrivilege toSentryPrivilege(TSentryAuthorizable tAuthorizable)
  throws SentryInvalidInputException {
 TSentryPrivilege tSentryPrivilege = new TSentryPrivilege();
 tSentryPrivilege.setDbName(fromNULLCol(tAuthorizable.getDb()));
 tSentryPrivilege.setServerName(fromNULLCol(tAuthorizable.getServer()));
 tSentryPrivilege.setTableName(fromNULLCol(tAuthorizable.getTable()));
 tSentryPrivilege.setColumnName(fromNULLCol(tAuthorizable.getColumn()));
 tSentryPrivilege.setURI(fromNULLCol(tAuthorizable.getUri()));
 PrivilegeScope scope;
 if (!isNULL(tSentryPrivilege.getColumnName())) {
  scope = PrivilegeScope.COLUMN;
 } else if (!isNULL(tSentryPrivilege.getTableName())) {
  scope = PrivilegeScope.TABLE;
 } else if (!isNULL(tSentryPrivilege.getDbName())) {
  scope = PrivilegeScope.DATABASE;
 } else if (!isNULL(tSentryPrivilege.getURI())) {
  scope = PrivilegeScope.URI;
 } else {
  scope = PrivilegeScope.SERVER;
 }
 tSentryPrivilege.setPrivilegeScope(scope.name());
 tSentryPrivilege.setAction(AccessConstants.ALL);
 return tSentryPrivilege;
}
org.apache.sentry.provider.db.service.thriftTSentryPrivilegesetAction

Popular methods of TSentryPrivilege

  • getAction
  • getDbName
  • getPrivilegeScope
  • getTableName
  • getColumnName
  • getGrantOption
  • 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
  • isSetAction,
  • isSetColumnName,
  • isSetDbName,
  • isSetGrantOption,
  • isSetPrivilegeScope,
  • isSetServerName,
  • isSetTableName,
  • isSetURI,
  • setColumnName

Popular in Java

  • Making http post requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • findViewById (Activity)
  • setScale (BigDecimal)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • BoxLayout (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top Vim plugins
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