private static void createLabels() throws IOException, InterruptedException { PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() { @Override public VisibilityLabelsResponse run() throws Exception { String[] labels = { SECRET, TOPSECRET, CONFIDENTIAL, PUBLIC, PRIVATE }; try (Connection conn = ConnectionFactory.createConnection(conf)) { VisibilityClient.addLabels(conn, labels); LOG.info("Added labels "); } catch (Throwable t) { LOG.error("Error in adding labels" , t); throw new IOException(t); } return null; } }; SUPERUSER.runAs(action); }
@SuppressFBWarnings("SIC_INNER_SHOULD_BE_STATIC_ANON") public void addLabels(final String... visibilities) throws IOException, InterruptedException { if (visibilities.length > 0) { PrivilegedExceptionAction<VisibilityLabelsProtos.VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsProtos.VisibilityLabelsResponse>() { @Override public VisibilityLabelsProtos.VisibilityLabelsResponse run() throws Exception { try (Connection conn = ConnectionFactory.createConnection(utility.getConfiguration())) { VisibilityClient.addLabels(conn, visibilities); } catch (final Throwable t) { throw new IOException(t); } return null; } }; final User superUser = User.createUserForTesting(getConfiguration(), "admin", new String[]{"supergroup"}); superUser.runAs(action); } }
private static void createLabels() throws IOException, InterruptedException { PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() { @Override public VisibilityLabelsResponse run() throws Exception { String[] labels = { SECRET, TOPSECRET, CONFIDENTIAL, PUBLIC, PRIVATE }; try { VisibilityClient.addLabels(conf, labels); LOG.info("Added labels "); } catch (Throwable t) { LOG.error("Error in adding labels" , t); throw new IOException(t); } return null; } }; SUPERUSER.runAs(action); }
private static void createLabels() throws IOException, InterruptedException { PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() { @Override public VisibilityLabelsResponse run() throws Exception { String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET }; try (Connection conn = ConnectionFactory.createConnection(conf)) { VisibilityClient.addLabels(conn, labels); } catch (Throwable t) { throw new IOException(t); } return null; } }; SUPERUSER.runAs(action); }
private static void createLabels() throws IOException, InterruptedException { PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() { public VisibilityLabelsResponse run() throws Exception { String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET }; try (Connection conn = ConnectionFactory.createConnection(conf)) { VisibilityClient.addLabels(conn, labels); } catch (Throwable t) { throw new IOException(t); } return null; } }; SUPERUSER.runAs(action); }
private static void setAuths() throws IOException { String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET }; try { VisibilityClient.setAuths(UTIL.getConnection(), labels, User.getCurrent().getShortName()); } catch (Throwable t) { throw new IOException(t); } }
private void addLabels() throws Exception { try { VisibilityClient.addLabels(util.getConnection(), LABELS); VisibilityClient.setAuths(util.getConnection(), LABELS, User.getCurrent().getName()); } catch (Throwable t) { throw new IOException(t); } }
private void addLabelsAndAuths() throws Exception { try { VisibilityClient.addLabels(util.getConnection(), LABELS); VisibilityClient.setAuths(util.getConnection(), new String[] { CONFIDENTIAL, TOPSECRET, SECRET, PRIVATE }, USER1.getName()); VisibilityClient.setAuths(util.getConnection(), new String[] { PUBLIC }, USER2.getName()); } catch (Throwable t) { throw new IOException(t); } }
private void addLabels() throws Exception { try { VisibilityClient.addLabels(util.getConnection(), labels.split(COMMA)); VisibilityClient.setAuths(util.getConnection(), labels.split(COMMA), USER.getName()); } catch (Throwable t) { throw new IOException(t); } }
private static void setAuths() throws Exception { String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET }; try (Connection conn = ConnectionFactory.createConnection(conf)) { VisibilityClient.setAuths(conn, labels, User.getCurrent().getShortName()); } catch (Throwable t) { throw new IOException(t); } }
private static void createLabels() throws IOException, InterruptedException { PrivilegedExceptionAction<VisibilityLabelsResponse> action = new PrivilegedExceptionAction<VisibilityLabelsResponse>() { public VisibilityLabelsResponse run() throws Exception { String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET }; try { VisibilityClient.addLabels(conf, labels); } catch (Throwable t) { throw new IOException(t); } return null; } }; SUPERUSER.runAs(action); }
private static void setAuths() throws IOException { String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET }; try { VisibilityClient.setAuths(conf, labels, User.getCurrent().getShortName()); } catch (Throwable t) { throw new IOException(t); } }
private static void setAuths() throws Exception { String[] labels = { SECRET, CONFIDENTIAL, PRIVATE, PUBLIC, TOPSECRET }; try { VisibilityClient.setAuths(conf, labels, User.getCurrent().getShortName()); } catch (Throwable t) { throw new IOException(t); } }
private void addLabels() throws Exception { try { VisibilityClient.addLabels(util.getConfiguration(), LABELS); VisibilityClient.setAuths(util.getConfiguration(), LABELS, User.getCurrent().getName()); } catch (Throwable t) { throw new IOException(t); } }
private void addLabelsAndAuths() throws Exception { try { VisibilityClient.addLabels(util.getConfiguration(), LABELS); VisibilityClient.setAuths(util.getConfiguration(), new String[] { CONFIDENTIAL, TOPSECRET, SECRET, PRIVATE }, USER1.getName()); VisibilityClient.setAuths(util.getConfiguration(), new String[] { PUBLIC }, USER2.getName()); } catch (Throwable t) { throw new IOException(t); } }
private static void addLabels(final Configuration conf, final List<String> users, final List<String> labels) throws Exception { PrivilegedExceptionAction<VisibilityLabelsProtos.VisibilityLabelsResponse> action = () -> { try (Connection conn = ConnectionFactory.createConnection(conf)) { VisibilityClient.addLabels(conn, labels.toArray(new String[labels.size()])); for (String user : users) { VisibilityClient.setAuths(conn, labels.toArray(new String[labels.size()]), user); } } catch (Throwable t) { throw new IOException(t); } return null; }; getUserByLogin(USER_ADMIN).runAs(action); }
private void addLabelsAndAuths() throws Exception { try { VisibilityClient.addLabels(util.getConfiguration(), LABELS); VisibilityClient.setAuths(util.getConfiguration(), LABELS, User.getCurrent().getName()); VisibilityClient.setAuths(util.getConfiguration(), new String[] { CONFIDENTIAL, TOPSECRET, SECRET, PRIVATE }, ADMIN.getName()); VisibilityClient.setAuths(util.getConfiguration(), new String[] { PUBLIC }, NORMAL_USER.getName()); } catch (Throwable t) { throw new IOException(t); } }