cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [4/4] git commit: Fix SimpleAuthorizer example; patch by Aleksey Yeschenko, reviewed by Jonathan Ellis for CASSANDRA-5072
Date Mon, 17 Dec 2012 15:42:01 GMT
Fix SimpleAuthorizer example;
patch by Aleksey Yeschenko, reviewed by Jonathan Ellis for
CASSANDRA-5072


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/706612e3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/706612e3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/706612e3

Branch: refs/heads/trunk
Commit: 706612e300ffc039ee35c07601cb60dab0486945
Parents: 9b217e4
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Mon Dec 17 18:35:31 2012 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Mon Dec 17 18:35:31 2012 +0300

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../apache/cassandra/auth/SimpleAuthorizer.java    |   10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/706612e3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 327d427..520cf08 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,6 +5,7 @@ Merged from 1.1:
  * fix temporarily missing schema after upgrade from pre-1.1.5 (CASSANDRA-5061)
  * Fix ALTER TABLE overriding compression options with defaults
    (CASSANDRA-4996, CASSANDRA-5066)
+ * Fix SimpleAuthorizer example (CASSANDRA-5072)
 
 
 1.2-rc1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/706612e3/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthorizer.java
----------------------------------------------------------------------
diff --git a/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthorizer.java
b/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthorizer.java
index 2d7b644..df62654 100644
--- a/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthorizer.java
+++ b/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthorizer.java
@@ -41,10 +41,10 @@ public class SimpleAuthorizer extends LegacyAuthorizer
     public EnumSet<Permission> authorize(AuthenticatedUser user, List<Object>
resource)
     {
         if (resource.size() < 2 || !Resources.ROOT.equals(resource.get(0)) || !Resources.KEYSPACES.equals(resource.get(1)))
-            return EnumSet.copyOf(Permission.NONE);
+            return EnumSet.noneOf(Permission.class);
         
         String keyspace, columnFamily = null;
-        EnumSet<Permission> authorized = EnumSet.copyOf(Permission.NONE);
+        EnumSet<Permission> authorized = EnumSet.noneOf(Permission.class);
         
         // /cassandra/keyspaces
         if (resource.size() == 2)
@@ -82,7 +82,7 @@ public class SimpleAuthorizer extends LegacyAuthorizer
             {
                 String kspAdmins = accessProperties.getProperty(KEYSPACES_WRITE_PROPERTY);
                 for (String admin : kspAdmins.split(","))
-                    if (admin.equals(user.username))
+                    if (admin.equals(user.getName()))
                         return EnumSet.copyOf(Permission.ALL);
             }
             
@@ -104,7 +104,7 @@ public class SimpleAuthorizer extends LegacyAuthorizer
             {
                 for (String reader : readers.split(","))
                 {
-                    if (reader.equals(user.username))
+                    if (reader.equals(user.getName()))
                     {
                         canRead = true;
                         break;
@@ -116,7 +116,7 @@ public class SimpleAuthorizer extends LegacyAuthorizer
             {
                 for (String writer : writers.split(","))
                 {
-                    if (writer.equals(user.username))
+                    if (writer.equals(user.getName()))
                     {
                         canWrite = true;
                         break;


Mime
View raw message