Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 215CFE1FB for ; Mon, 14 Jan 2013 20:20:36 +0000 (UTC) Received: (qmail 83918 invoked by uid 500); 14 Jan 2013 20:20:36 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 83873 invoked by uid 500); 14 Jan 2013 20:20:36 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 83866 invoked by uid 99); 14 Jan 2013 20:20:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jan 2013 20:20:36 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jan 2013 20:20:33 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id BE3D223889BB; Mon, 14 Jan 2013 20:20:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1433099 - /accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java Date: Mon, 14 Jan 2013 20:20:13 -0000 To: commits@accumulo.apache.org From: ecn@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130114202013.BE3D223889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ecn Date: Mon Jan 14 20:20:13 2013 New Revision: 1433099 URL: http://svn.apache.org/viewvc?rev=1433099&view=rev Log: ACCUMULO-282 add in user authorizations so the simple example works simply Modified: accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java Modified: accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java?rev=1433099&r1=1433098&r2=1433099&view=diff ============================================================================== --- accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java (original) +++ accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java Mon Jan 14 20:20:13 2013 @@ -16,7 +16,13 @@ */ package org.apache.accumulo.examples.simple.client; +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; import java.util.Map.Entry; +import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -31,6 +37,7 @@ import org.apache.accumulo.core.data.Mut import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.ColumnVisibility; +import org.apache.accumulo.core.util.ByteArraySet; import org.apache.hadoop.io.Text; import com.beust.jcommander.Parameter; @@ -65,6 +72,14 @@ public class ReadWriteExample { private void execute(Opts opts, ScannerOpts scanOpts) throws Exception { conn = opts.getConnector(); + + // add the authorizations to the user + Authorizations userAuthorizations = conn.securityOperations().getUserAuthorizations(opts.user); + ByteArraySet auths = new ByteArraySet(userAuthorizations.getAuthorizations()); + auths.addAll(opts.auths.getAuthorizations()); + if (!auths.isEmpty()) + conn.securityOperations().changeUserAuthorizations(opts.user, new Authorizations(auths)); + // create table if (opts.createtable) { SortedSet partitionKeys = new TreeSet();