Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: service/rawdatastore/datastore_key.go

Issue 1253263002: Make rawdatastore API safer for writing filters. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fix comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « service/rawdatastore/context_test.go ('k') | service/rawdatastore/datastore_key_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/rawdatastore/datastore_key.go
diff --git a/service/rawdatastore/datastore_key.go b/service/rawdatastore/datastore_key.go
index 672842cccd1e2f1a133c7eda277ef0f57114aab0..c9e74dd8e35c68679e99e083ecb63e24a91928f8 100644
--- a/service/rawdatastore/datastore_key.go
+++ b/service/rawdatastore/datastore_key.go
@@ -120,19 +120,16 @@ func KeyIncomplete(k Key) bool {
// KeyValid determines if a key is valid, according to a couple rules:
// - k is not nil
-// - k's namespace matches ns
// - every token of k:
// - (if !allowSpecial) token's kind doesn't start with '__'
// - token's kind and appid are non-blank
// - token is not incomplete
// - all tokens have the same namespace and appid
-func KeyValid(k Key, ns string, allowSpecial bool) bool {
+func KeyValid(k Key, allowSpecial bool, aid, ns string) bool {
if k == nil {
return false
}
- // since we do "client-side" validation of namespaces in local
- // implementations, it's convenient to check this here.
- if k.Namespace() != ns {
+ if aid != k.AppID() || ns != k.Namespace() {
return false
}
for ; k != nil; k = k.Parent() {
« no previous file with comments | « service/rawdatastore/context_test.go ('k') | service/rawdatastore/datastore_key_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698