mirror of https://github.com/apache/cassandra
CF access test for SimpleAuthority
Patch by eevans; reviewed by Stu Hood for CASSANDRA-1554 git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@1005081 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c293406703
commit
bbf1afa0dd
|
|
@ -24,5 +24,6 @@
|
|||
# list of keyspaces: all users will be able to view the list of keyspaces.
|
||||
<modify-keyspaces>=user1
|
||||
|
||||
Keyspace1.<read>=user1,user2
|
||||
Keyspace1.<write>=user1,user2
|
||||
Keyspace1.<rw>=user1,user2
|
||||
Keyspace1.Standard1.<ro>=user2
|
||||
Keyspace1.Standard1.<rw>=user1
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import java.util.Arrays;
|
|||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
|
@ -38,6 +37,10 @@ public class SimpleAuthorityTest
|
|||
private final List<Object> KEYSPACES_RESOURCE = Arrays.<Object>asList(Resources.ROOT, Resources.KEYSPACES);
|
||||
private final List<Object> KEYSPACE1_RESOURCE = Arrays.<Object>asList(Resources.ROOT, Resources.KEYSPACES, "Keyspace1");
|
||||
private final List<Object> KEYSPACE2_RESOURCE = Arrays.<Object>asList(Resources.ROOT, Resources.KEYSPACES, "Keyspace2");
|
||||
private final List<Object> STANDARD1_RESOURCE = Arrays.<Object>asList(Resources.ROOT,
|
||||
Resources.KEYSPACES,
|
||||
"Keyspace1",
|
||||
"Standard1");
|
||||
|
||||
@Test
|
||||
public void testValidateConfiguration() throws Exception
|
||||
|
|
@ -70,4 +73,12 @@ public class SimpleAuthorityTest
|
|||
EnumSet.of(Permission.READ),
|
||||
authority.authorize(USER3, KEYSPACES_RESOURCE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAuthorizeColumnFamily() throws Exception
|
||||
{
|
||||
assertEquals(Permission.ALL, authority.authorize(USER1, STANDARD1_RESOURCE));
|
||||
assertEquals(EnumSet.of(Permission.READ), authority.authorize(USER2, STANDARD1_RESOURCE));
|
||||
assertEquals(Permission.NONE, authority.authorize(USER3, STANDARD1_RESOURCE));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue