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

Side by Side Diff: appengine/logdog/coordinator/endpoints/logs/service.go

Issue 1970823005: LogDog: Add prefix registration endpoint. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-archivist-useconfig
Patch Set: Updated patchset dependency Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package logs 5 package logs
6 6
7 import ( 7 import (
8 "github.com/golang/protobuf/proto" 8 "github.com/golang/protobuf/proto"
9 "github.com/luci/luci-go/appengine/logdog/coordinator" 9 "github.com/luci/luci-go/appengine/logdog/coordinator"
10 "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints" 10 "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints"
(...skipping 27 matching lines...) Expand all
38 // We use a type switch here because this is a shared de corator. All user 38 // We use a type switch here because this is a shared de corator. All user
39 // mesages must implement ProjectBoundMessage. 39 // mesages must implement ProjectBoundMessage.
40 pbm, ok := req.(endpoints.ProjectBoundMessage) 40 pbm, ok := req.(endpoints.ProjectBoundMessage)
41 if ok { 41 if ok {
42 // Enter the requested project namespace. This v alidates that the 42 // Enter the requested project namespace. This v alidates that the
43 // current user has READ access. 43 // current user has READ access.
44 project := config.ProjectName(pbm.GetMessageProj ect()) 44 project := config.ProjectName(pbm.GetMessageProj ect())
45 log.Fields{ 45 log.Fields{
46 "project": project, 46 "project": project,
47 }.Debugf(c, "User is accessing project.") 47 }.Debugf(c, "User is accessing project.")
48 » » » » if err := coordinator.WithProjectNamespace(&c, p roject); err != nil { 48 » » » » if err := coordinator.WithProjectNamespace(&c, p roject, coordinator.NamespaceAccessREAD); err != nil {
49 return nil, getGRPCError(c, err) 49 return nil, getGRPCError(c, err)
50 } 50 }
51 } 51 }
52 52
53 return c, nil 53 return c, nil
54 }, 54 },
55 } 55 }
56 } 56 }
57 57
58 func getGRPCError(c context.Context, err error) error { 58 func getGRPCError(c context.Context, err error) error {
(...skipping 16 matching lines...) Expand all
75 75
76 func (s *server) limit(v int, d int) int { 76 func (s *server) limit(v int, d int) int {
77 if s.resultLimit > 0 { 77 if s.resultLimit > 0 {
78 d = s.resultLimit 78 d = s.resultLimit
79 } 79 }
80 if v <= 0 || v > d { 80 if v <= 0 || v > d {
81 return d 81 return d
82 } 82 }
83 return v 83 return v
84 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698