Add dtest for CASSANDRA-13053
Project: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/commit/13a8ec4b Tree: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/tree/13a8ec4b Diff: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/diff/13a8ec4b Branch: refs/heads/master Commit: 13a8ec4ba3c9e4edfee50bac2385bd769c62c25f Parents: eb3b574 Author: Aleksey Yeschenko <alek...@yeschenko.com> Authored: Tue Mar 7 15:17:55 2017 +0000 Committer: Aleksey Yeschenko <alek...@yeschenko.com> Committed: Wed Mar 8 00:25:14 2017 +0000 ---------------------------------------------------------------------- auth_test.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/13a8ec4b/auth_test.py ---------------------------------------------------------------------- diff --git a/auth_test.py b/auth_test.py index c321828..2749209 100644 --- a/auth_test.py +++ b/auth_test.py @@ -654,6 +654,39 @@ class TestAuth(Tester): rows = list(cathy.execute("TRUNCATE ks.cf")) self.assertItemsEqual(rows, []) + @since('2.2') + def grant_revoke_without_ks_specified_test(self): + """ + * Launch a one node cluster + * Connect as the default superuser + * Create table ks.cf + * Create a new users, 'cathy' and 'bob', with no permissions + * Grant ALL on ks.cf to cathy + * As cathy, try granting SELECT on cf to bob, without specifying the ks; verify it fails + * As cathy, USE ks, try again, verify it works this time + """ + self.prepare() + + cassandra = self.get_session(user='cassandra', password='cassandra') + + cassandra.execute("CREATE KEYSPACE ks WITH replication = {'class':'SimpleStrategy', 'replication_factor':1}") + cassandra.execute("CREATE TABLE ks.cf (id int primary key, val int)") + + cassandra.execute("CREATE USER cathy WITH PASSWORD '12345'") + cassandra.execute("CREATE USER bob WITH PASSWORD '12345'") + + cassandra.execute("GRANT ALL ON ks.cf TO cathy") + + cathy = self.get_session(user='cathy', password='12345') + bob = self.get_session(user='bob', password='12345') + + assert_invalid(cathy, "GRANT SELECT ON cf TO bob", "No keyspace has been specified. USE a keyspace, or explicitly specify keyspace.tablename") + assert_unauthorized(bob, "SELECT * FROM ks.cf", "User bob has no SELECT permission on <table ks.cf> or any of its parents") + + cathy.execute("USE ks") + cathy.execute("GRANT SELECT ON cf TO bob") + bob.execute("SELECT * FROM ks.cf") + def grant_revoke_auth_test(self): """ * Launch a one node cluster --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org