Examples of AccumuloGraph


Examples of org.securegraph.accumulo.AccumuloGraph

            @Override
            public void run() {
                LOGGER.debug("got lock to add authorization [%s] for secure graph user", auth);
                if (graph instanceof AccumuloGraph) {
                    try {
                        AccumuloGraph accumuloGraph = (AccumuloGraph) graph;
                        String principal = accumuloGraph.getConnector().whoami();
                        Authorizations currentAuthorizations = accumuloGraph.getConnector().securityOperations().getUserAuthorizations(principal);
                        if (currentAuthorizations.contains(auth)) {
                            return;
                        }
                        List<byte[]> newAuthorizationsArray = new ArrayList<byte[]>();
                        for (byte[] currentAuth : currentAuthorizations) {
                            newAuthorizationsArray.add(currentAuth);
                        }
                        newAuthorizationsArray.add(auth.getBytes(Constants.UTF8));
                        Authorizations newAuthorizations = new Authorizations(newAuthorizationsArray);
                        accumuloGraph.getConnector().securityOperations().changeUserAuthorizations(principal, newAuthorizations);
                    } catch (Exception ex) {
                        throw new RuntimeException("Could not update authorizations in accumulo", ex);
                    }
                } else {
                    throw new RuntimeException("graph type not supported to add authorizations.");
View Full Code Here

Examples of org.securegraph.accumulo.AccumuloGraph

            @Override
            public void run() {
                LOGGER.debug("got lock removing authorization to graph user %s", auth);
                if (graph instanceof AccumuloGraph) {
                    try {
                        AccumuloGraph accumuloGraph = (AccumuloGraph) graph;
                        String principal = accumuloGraph.getConnector().whoami();
                        Authorizations currentAuthorizations = accumuloGraph.getConnector().securityOperations().getUserAuthorizations(principal);
                        if (!currentAuthorizations.toString().contains(auth)) {
                            return;
                        }
                        byte[] authBytes = auth.getBytes(Constants.UTF8);
                        List<byte[]> newAuthorizationsArray = new ArrayList<byte[]>();
                        for (byte[] currentAuth : currentAuthorizations) {
                            if (Arrays.equals(currentAuth, authBytes)) {
                                continue;
                            }
                            newAuthorizationsArray.add(currentAuth);
                        }
                        Authorizations newAuthorizations = new Authorizations(newAuthorizationsArray);
                        accumuloGraph.getConnector().securityOperations().changeUserAuthorizations(principal, newAuthorizations);
                    } catch (Exception ex) {
                        throw new RuntimeException("Could not update authorizations in accumulo", ex);
                    }
                } else {
                    throw new RuntimeException("graph type not supported to add authorizations.");
View Full Code Here

Examples of org.securegraph.accumulo.AccumuloGraph

    @Override
    public List<String> getGraphAuthorizations() {
        if (graph instanceof AccumuloGraph) {
            try {
                AccumuloGraph accumuloGraph = (AccumuloGraph) graph;
                String principal = accumuloGraph.getConnector().whoami();
                Authorizations currentAuthorizations = accumuloGraph.getConnector().securityOperations().getUserAuthorizations(principal);
                ArrayList<String> auths = new ArrayList<String>();
                for (byte[] currentAuth : currentAuthorizations) {
                    auths.add(new String(currentAuth));
                }
                return auths;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.