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

How to use
getUserAuthorizations
method
in
org.apache.accumulo.core.client.admin.SecurityOperations

Best Java code snippets using org.apache.accumulo.core.client.admin.SecurityOperations.getUserAuthorizations (Showing top 20 results out of 315)

origin: prestodb/presto

@Inject
public AccumuloClient(
    Connector connector,
    AccumuloConfig config,
    ZooKeeperMetadataManager metaManager,
    AccumuloTableManager tableManager,
    IndexLookup indexLookup)
    throws AccumuloException, AccumuloSecurityException
{
  this.connector = requireNonNull(connector, "connector is null");
  this.username = requireNonNull(config, "config is null").getUsername();
  this.metaManager = requireNonNull(metaManager, "metaManager is null");
  this.tableManager = requireNonNull(tableManager, "tableManager is null");
  this.indexLookup = requireNonNull(indexLookup, "indexLookup is null");
  this.auths = connector.securityOperations().getUserAuthorizations(username);
}
origin: prestodb/presto

Authorizations scanAuths = connector.securityOperations().getUserAuthorizations(sessionScanUser);
LOG.debug("Using session scanner auths for user %s: %s", sessionScanUser, scanAuths);
return scanAuths;
Authorizations auths = connector.securityOperations().getUserAuthorizations(username);
LOG.debug("scan_auths table property not set, using user auths: %s", auths);
return auths;
origin: prestodb/presto

private Optional<String> getDefaultTabletLocation(String fulltable)
{
  try {
    String tableId = connector.tableOperations().tableIdMap().get(fulltable);
    // Create a scanner over the metadata table, fetching the 'loc' column of the default tablet row
    Scanner scan = connector.createScanner("accumulo.metadata", connector.securityOperations().getUserAuthorizations(username));
    scan.fetchColumnFamily(new Text("loc"));
    scan.setRange(new Range(tableId + '<'));
    // scan the entry
    Optional<String> location = Optional.empty();
    for (Entry<Key, Value> entry : scan) {
      if (location.isPresent()) {
        throw new PrestoException(FUNCTION_IMPLEMENTATION_ERROR, "Scan for default tablet returned more than one entry");
      }
      location = Optional.of(entry.getValue().toString());
    }
    scan.close();
    return location;
  }
  catch (Exception e) {
    // Swallow this exception so the query does not fail due to being unable to locate the tablet server for the default tablet.
    // This is purely an optimization, but we will want to log the error.
    LOG.error("Failed to get tablet location, returning dummy location", e);
    return Optional.empty();
  }
}
origin: prestodb/presto

new Indexer(
    connector,
    connector.securityOperations().getUserAuthorizations(username),
    table,
    conf));
origin: prestodb/presto

Authorizations scanAuths = connector.securityOperations().getUserAuthorizations(sessionScanUser);
LOG.debug("Using session scan auths for user %s: %s", sessionScanUser, scanAuths);
return scanAuths;
origin: apache/accumulo

protected Authorizations getAuths(final CommandLine cl, final Shell shellState)
  throws AccumuloSecurityException, AccumuloException {
 final String user = shellState.getAccumuloClient().whoami();
 Authorizations auths = shellState.getAccumuloClient().securityOperations()
   .getUserAuthorizations(user);
 if (cl.hasOption(scanOptAuths.getOpt())) {
  auths = ScanCommand.parseAuthorizations(cl.getOptionValue(scanOptAuths.getOpt()));
 }
 return auths;
}
origin: apache/accumulo

@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
  throws AccumuloException, AccumuloSecurityException {
 final String user = cl.getOptionValue(userOpt.getOpt(),
   shellState.getAccumuloClient().whoami());
 final String scanOpts = cl.getOptionValue(scanOptAuths.getOpt());
 Authorizations auths = shellState.getAccumuloClient().securityOperations()
   .getUserAuthorizations(user);
 StringBuilder userAuths = new StringBuilder();
 if (!auths.isEmpty()) {
  userAuths.append(auths);
  userAuths.append(",");
 }
 userAuths.append(scanOpts);
 shellState.getAccumuloClient().securityOperations().changeUserAuthorizations(user,
   ScanCommand.parseAuthorizations(userAuths.toString()));
 Shell.log.debug("Changed record-level authorizations for user " + user);
 return 0;
}
origin: apache/accumulo

@Override
public Scanner createScanner(String tableName)
  throws TableNotFoundException, AccumuloSecurityException, AccumuloException {
 Authorizations auths = securityOperations().getUserAuthorizations(getPrincipal());
 return createScanner(tableName, auths);
}
origin: apache/accumulo

@Override
public BatchScanner createBatchScanner(String tableName)
  throws TableNotFoundException, AccumuloSecurityException, AccumuloException {
 Authorizations auths = securityOperations().getUserAuthorizations(getPrincipal());
 return createBatchScanner(tableName, auths);
}
origin: apache/accumulo

@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
  throws AccumuloException, AccumuloSecurityException {
 final AccumuloClient accumuloClient = shellState.getAccumuloClient();
 final String user = cl.getOptionValue(userOpt.getOpt(), accumuloClient.whoami());
 final String scanOpts = cl.getOptionValue(scanOptAuths.getOpt());
 final Authorizations auths = accumuloClient.securityOperations().getUserAuthorizations(user);
 final StringBuilder userAuths = new StringBuilder();
 final String[] toBeRemovedAuths = scanOpts.split(",");
 final Set<String> toBeRemovedSet = new HashSet<>();
 for (String auth : toBeRemovedAuths) {
  toBeRemovedSet.add(auth);
 }
 final String[] existingAuths = auths.toString().split(",");
 for (String auth : existingAuths) {
  if (!toBeRemovedSet.contains(auth)) {
   userAuths.append(auth);
   userAuths.append(",");
  }
 }
 if (userAuths.length() > 0) {
  accumuloClient.securityOperations().changeUserAuthorizations(user,
    ScanCommand.parseAuthorizations(userAuths.substring(0, userAuths.length() - 1)));
 } else {
  accumuloClient.securityOperations().changeUserAuthorizations(user, new Authorizations());
 }
 Shell.log.debug("Changed record-level authorizations for user " + user);
 return 0;
}
origin: apache/accumulo

@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
  throws AccumuloException, AccumuloSecurityException, IOException {
 final String user = cl.getOptionValue(userOpt.getOpt(),
   shellState.getAccumuloClient().whoami());
 // Sort authorizations
 Authorizations auths = shellState.getAccumuloClient().securityOperations()
   .getUserAuthorizations(user);
 List<String> set = sortAuthorizations(auths);
 shellState.getReader().println(StringUtils.join(set, ','));
 return 0;
}
origin: apache/accumulo

  .getUserAuthorizations(user);
final Scanner scanner = shellState.getAccumuloClient().createScanner(tableName, auths);
for (IteratorSetting s : tableScanIterators) {
origin: apache/accumulo

@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN",
  justification = "code runs in same security context as user who provided input")
private static void printUserConfiguration(AccumuloClient accumuloClient, String user,
  File outputDirectory) throws IOException, AccumuloException, AccumuloSecurityException {
 File userScript = new File(outputDirectory, user + USER_FILE_SUFFIX);
 FileWriter userWriter = new FileWriter(userScript);
 userWriter.write(createUserFormat.format(new String[] {user}));
 Authorizations auths = accumuloClient.securityOperations().getUserAuthorizations(user);
 userWriter.write(userAuthsFormat.format(new String[] {user, auths.toString()}));
 for (SystemPermission sp : SystemPermission.values()) {
  if (accumuloClient.securityOperations().hasSystemPermission(user, sp)) {
   userWriter.write(sysPermFormat.format(new String[] {sp.name(), user}));
  }
 }
 for (String namespace : accumuloClient.namespaceOperations().list()) {
  for (NamespacePermission np : NamespacePermission.values()) {
   if (accumuloClient.securityOperations().hasNamespacePermission(user, namespace, np)) {
    userWriter.write(nsPermFormat.format(new String[] {np.name(), namespace, user}));
   }
  }
 }
 for (String tableName : accumuloClient.tableOperations().list()) {
  for (TablePermission perm : TablePermission.values()) {
   if (accumuloClient.securityOperations().hasTablePermission(user, tableName, perm)) {
    userWriter.write(tablePermFormat.format(new String[] {perm.name(), tableName, user}));
   }
  }
 }
 userWriter.close();
}
origin: apache/accumulo

final String user = shellState.getAccumuloClient().whoami();
final Authorizations auths = shellState.getAccumuloClient().securityOperations()
  .getUserAuthorizations(user);
final Scanner scanner = shellState.getAccumuloClient().createScanner(table, auths);
scanner.setRange(new Range(new Text(Long.toHexString(trace))));
origin: apache/incubator-rya

/**
 * @return the {@link Authorizations} of this instance's user.
 * @throws AccumuloException
 * @throws AccumuloSecurityException
 */
public Authorizations getAuths() throws AccumuloException, AccumuloSecurityException {
  if (secOps != null) {
    return secOps.getUserAuthorizations(user);
  } else {
    return null;
  }
}
origin: apache/incubator-rya

/**
 * @return the {@link Authorizations} of this instance's user.
 * @throws AccumuloException
 * @throws AccumuloSecurityException
 */
public Authorizations getAuths() throws AccumuloException, AccumuloSecurityException {
  if (secOps != null) {
    return secOps.getUserAuthorizations(user);
  } else {
    return null;
  }
}
origin: org.apache.accumulo/accumulo-shell

protected Authorizations getAuths(final CommandLine cl, final Shell shellState)
  throws AccumuloSecurityException, AccumuloException {
 final String user = shellState.getConnector().whoami();
 Authorizations auths = shellState.getConnector().securityOperations()
   .getUserAuthorizations(user);
 if (cl.hasOption(scanOptAuths.getOpt())) {
  auths = ScanCommand.parseAuthorizations(cl.getOptionValue(scanOptAuths.getOpt()));
 }
 return auths;
}
origin: org.apache.accumulo/accumulo-test

 @Override
 public String getErrorMessage() {
  try {
   Connector c = getConnector();
   return "Current auths for root are: "
     + c.securityOperations().getUserAuthorizations("root").toString();
  } catch (Exception e) {
   return "Could not check authorizations";
  }
 }
});
origin: org.apache.accumulo/accumulo-shell

@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
  throws AccumuloException, AccumuloSecurityException, IOException {
 final String user = cl.getOptionValue(userOpt.getOpt(), shellState.getConnector().whoami());
 // Sort authorizations
 Authorizations auths = shellState.getConnector().securityOperations()
   .getUserAuthorizations(user);
 List<String> set = sortAuthorizations(auths);
 shellState.getReader().println(StringUtils.join(set, ','));
 return 0;
}
origin: org.apache.accumulo/accumulo-proxy

@Override
public List<ByteBuffer> getUserAuthorizations(ByteBuffer login, String user)
  throws org.apache.accumulo.proxy.thrift.AccumuloException,
  org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException {
 try {
  return getConnector(login).securityOperations().getUserAuthorizations(user)
    .getAuthorizationsBB();
 } catch (Exception e) {
  handleException(e);
  return null;
 }
}
org.apache.accumulo.core.client.adminSecurityOperationsgetUserAuthorizations

Javadoc

Retrieves the user's authorizations for scanning

Popular methods of SecurityOperations

  • changeUserAuthorizations
    Set the user's record-level authorizations
  • hasTablePermission
    Verify the user has a particular table permission
  • authenticateUser
    Verify a username/password combination is valid
  • createLocalUser
    Create a user
  • grantTablePermission
    Grant a user a specific permission for a specific table
  • hasSystemPermission
    Verify the user has a particular system permission
  • hasNamespacePermission
    Verify the user has a particular namespace permission
  • listLocalUsers
    Return a list of users in accumulo
  • getDelegationToken
    Obtain a DelegationToken for use when Kerberos credentials cannot be used (e.g. YARN Jobs)
  • revokeTablePermission
    Revoke a table permission for a specific user on a specific table
  • changeLocalUserPassword
    Set the user's password
  • grantSystemPermission
    Grant a user a system permission
  • changeLocalUserPassword,
  • grantSystemPermission,
  • revokeSystemPermission,
  • dropLocalUser,
  • grantNamespacePermission,
  • revokeNamespacePermission

Popular in Java

  • Updating database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • putExtra (Intent)
  • onRequestPermissionsResult (Fragment)
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • 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