mirror of https://github.com/apache/cassandra
Fix CQL3 BATCH authorization caching
patch by Aleksey Yeschenko; reviewed by Sylvain Lebresne for CASSANDRA-5145
This commit is contained in:
parent
ccdb632d40
commit
3bb84e9e2a
|
|
@ -7,6 +7,7 @@
|
|||
* Pig: correctly decode row keys in widerow mode (CASSANDRA-5098)
|
||||
* nodetool repair command now prints progress (CASSANDRA-4767)
|
||||
* fix user defined compaction to run against 1.1 data directory (CASSANDRA-5118)
|
||||
* Fix CQL3 BATCH authorization caching (CASSANDRA-5145)
|
||||
|
||||
|
||||
1.1.8
|
||||
|
|
|
|||
|
|
@ -65,14 +65,21 @@ public class BatchStatement extends ModificationStatement
|
|||
@Override
|
||||
public void checkAccess(ClientState state) throws InvalidRequestException
|
||||
{
|
||||
Set<String> cfamsSeen = new HashSet<String>();
|
||||
Map<String, Set<String>> cfamsSeen = new HashMap<String, Set<String>>();
|
||||
for (ModificationStatement statement : statements)
|
||||
{
|
||||
// Avoid unnecessary authorizations.
|
||||
if (!(cfamsSeen.contains(statement.columnFamily())))
|
||||
String ks = statement.keyspace();
|
||||
String cf = statement.columnFamily();
|
||||
|
||||
if (!cfamsSeen.containsKey(ks))
|
||||
cfamsSeen.put(ks, new HashSet<String>());
|
||||
|
||||
// Avoid unnecessary authorization.
|
||||
Set<String> cfs = cfamsSeen.get(ks);
|
||||
if (!(cfs.contains(cf)))
|
||||
{
|
||||
state.hasColumnFamilyAccess(statement.keyspace(), statement.columnFamily(), Permission.WRITE);
|
||||
cfamsSeen.add(statement.columnFamily());
|
||||
state.hasColumnFamilyAccess(ks, cf, Permission.WRITE);
|
||||
cfs.add(cf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue