/** * @param conf * @param user * @return labels, the given user is globally authorized for. * @throws Throwable * @deprecated Use {@link #getAuths(Connection,String)} instead. */ @Deprecated public static GetAuthsResponse getAuths(Configuration conf, final String user) throws Throwable { try (Connection connection = ConnectionFactory.createConnection(conf)) { return getAuths(connection, user); } }
@Override public GetAuthsResponse run() throws Exception { try (Connection conn = ConnectionFactory.createConnection(conf)) { return VisibilityClient.getAuths(conn, "user1"); } catch (Throwable e) { } return null; } };
@Override public GetAuthsResponse run() throws Exception { try (Connection conn = ConnectionFactory.createConnection(conf)) { return VisibilityClient.getAuths(conn, "user3"); } catch (Throwable e) { } return null; } };
@Override public List<String> run() throws Exception { GetAuthsResponse authsResponse = null; try (Connection conn = ConnectionFactory.createConnection(conf)) { authsResponse = VisibilityClient.getAuths(conn, USER_RW.getShortName()); } catch (Throwable t) { fail("Should not have failed"); } List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size()); for (ByteString authBS : authsResponse.getAuthList()) { authsList.add(Bytes.toString(authBS.toByteArray())); } return authsList; } };
@Override public Void run() throws Exception { GetAuthsResponse authsResponse = null; try (Connection conn = ConnectionFactory.createConnection(conf)) { authsResponse = VisibilityClient.getAuths(conn, "@testgroup"); } catch (Throwable e) { fail("Should not have failed"); } List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size()); for (ByteString authBS : authsResponse.getAuthList()) { authsList.add(Bytes.toString(authBS.toByteArray())); } assertEquals(0, authsList.size()); return null; } });
@Override public Void run() throws Exception { GetAuthsResponse authsResponse = null; try (Connection conn = ConnectionFactory.createConnection(conf)) { authsResponse = VisibilityClient.getAuths(conn, user); } catch (Throwable e) { throw new IOException(e); } List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size()); for (ByteString authBS : authsResponse.getAuthList()) { authsList.add(Bytes.toString(authBS.toByteArray())); } assertEquals(2, authsList.size()); assertTrue(authsList.contains(SECRET)); assertTrue(authsList.contains(CONFIDENTIAL)); return null; } };
@Override public Void run() throws Exception { GetAuthsResponse authsResponse = null; try (Connection conn = ConnectionFactory.createConnection(conf)) { authsResponse = VisibilityClient.getAuths(conn, "@testgroup"); } catch (Throwable e) { fail("Should not have failed"); } List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size()); for (ByteString authBS : authsResponse.getAuthList()) { authsList.add(Bytes.toString(authBS.toByteArray())); } assertEquals(1, authsList.size()); assertTrue(authsList.contains(CONFIDENTIAL)); return null; } });
@Override public Void run() throws Exception { String[] auths1 = { SECRET, CONFIDENTIAL }; GetAuthsResponse authsResponse = null; try (Connection conn = ConnectionFactory.createConnection(conf)) { VisibilityClient.setAuths(conn, auths1, user); try { authsResponse = VisibilityClient.getAuths(conn, user); } catch (Throwable e) { throw new IOException(e); } } catch (Throwable e) { } List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size()); for (ByteString authBS : authsResponse.getAuthList()) { authsList.add(Bytes.toString(authBS.toByteArray())); } assertEquals(2, authsList.size()); assertTrue(authsList.contains(SECRET)); assertTrue(authsList.contains(CONFIDENTIAL)); return null; } };
authsResponse = VisibilityClient.getAuths(conn, user); } catch (Throwable e) { throw new IOException(e);
/** * @param conf * @param user * @return labels, the given user is globally authorized for. * @throws Throwable * @deprecated Use {@link #getAuths(Connection,String)} instead. */ @Deprecated public static GetAuthsResponse getAuths(Configuration conf, final String user) throws Throwable { try (Connection connection = ConnectionFactory.createConnection(conf)) { return getAuths(connection, user); } }
@Override public Void run() { try { // vv VisibilityLabelExample /* */VisibilityLabelsProtos.GetAuthsResponse response = /* */ VisibilityClient.getAuths(user.getConnection(), assignee); /* */System.out.println("User Authorizations for " + assignee + ":"); /* */int count = 0; /* */for (ByteString auth : response.getAuthList()) { /* */ System.out.println(" " + auth.toStringUtf8()); /* */ count++; /* */} /* */System.out.println("Got " + count + " user authorizations."); /*...*/ // ^^ VisibilityLabelExample } catch (Throwable throwable) { System.out.println("printUserAuthorization() failed with: " + throwable.getMessage().split("\n")[0]); } return null; } });
/** * @param conf * @param user * @return labels, the given user is globally authorized for. * @throws Throwable * @deprecated Use {@link #getAuths(Connection,String)} instead. */ @Deprecated public static GetAuthsResponse getAuths(Configuration conf, final String user) throws Throwable { try (Connection connection = ConnectionFactory.createConnection(conf)) { return getAuths(connection, user); } }
/** * @param conf * @param user * @return labels, the given user is globally authorized for. * @throws Throwable * @deprecated Use {@link #getAuths(Connection,String)} instead. */ @Deprecated public static GetAuthsResponse getAuths(Configuration conf, final String user) throws Throwable { try (Connection connection = ConnectionFactory.createConnection(conf)) { return getAuths(connection, user); } }
@Override public GetAuthsResponse run() throws Exception { try (Connection conn = ConnectionFactory.createConnection(conf)) { return VisibilityClient.getAuths(conn, "user1"); } catch (Throwable e) { } return null; } };
@Override public GetAuthsResponse run() throws Exception { try (Connection conn = ConnectionFactory.createConnection(conf)) { return VisibilityClient.getAuths(conn, "user3"); } catch (Throwable e) { } return null; } };
@Override public Void run() throws Exception { GetAuthsResponse authsResponse = null; try (Connection conn = ConnectionFactory.createConnection(conf)) { authsResponse = VisibilityClient.getAuths(conn, "@testgroup"); } catch (Throwable e) { fail("Should not have failed"); } List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size()); for (ByteString authBS : authsResponse.getAuthList()) { authsList.add(Bytes.toString(authBS.toByteArray())); } assertEquals(0, authsList.size()); return null; } });
@Override public Void run() throws Exception { GetAuthsResponse authsResponse = null; try (Connection conn = ConnectionFactory.createConnection(conf)) { authsResponse = VisibilityClient.getAuths(conn, "@testgroup"); } catch (Throwable e) { fail("Should not have failed"); } List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size()); for (ByteString authBS : authsResponse.getAuthList()) { authsList.add(Bytes.toString(authBS.toByteArray())); } assertEquals(1, authsList.size()); assertTrue(authsList.contains(CONFIDENTIAL)); return null; } });
@Override public List<String> run() throws Exception { GetAuthsResponse authsResponse = null; try (Connection conn = ConnectionFactory.createConnection(conf)) { authsResponse = VisibilityClient.getAuths(conn, USER_RW.getShortName()); } catch (Throwable t) { fail("Should not have failed"); } List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size()); for (ByteString authBS : authsResponse.getAuthList()) { authsList.add(Bytes.toString(authBS.toByteArray())); } return authsList; } };
@Override public Void run() throws Exception { GetAuthsResponse authsResponse = null; try (Connection conn = ConnectionFactory.createConnection(conf)) { authsResponse = VisibilityClient.getAuths(conn, user); } catch (Throwable e) { fail("Should not have failed"); } List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size()); for (ByteString authBS : authsResponse.getAuthList()) { authsList.add(Bytes.toString(authBS.toByteArray())); } assertEquals(2, authsList.size()); assertTrue(authsList.contains(SECRET)); assertTrue(authsList.contains(CONFIDENTIAL)); return null; } };
@Override public Void run() throws Exception { String[] auths1 = { SECRET, CONFIDENTIAL }; GetAuthsResponse authsResponse = null; try (Connection conn = ConnectionFactory.createConnection(conf)) { VisibilityClient.setAuths(conn, auths1, user); try { authsResponse = VisibilityClient.getAuths(conn, user); } catch (Throwable e) { fail("Should not have failed"); } } catch (Throwable e) { } List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size()); for (ByteString authBS : authsResponse.getAuthList()) { authsList.add(Bytes.toString(authBS.toByteArray())); } assertEquals(2, authsList.size()); assertTrue(authsList.contains(SECRET)); assertTrue(authsList.contains(CONFIDENTIAL)); return null; } };