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

Side by Side Diff: milo/appengine/common/middleware.go

Issue 2810113002: Milo buildbot builder page: Add pagnation with cursors. (Closed)
Patch Set: Touchups Created 3 years, 8 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 LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package common 5 package common
6 6
7 import ( 7 import (
8 "net/http" 8 "net/http"
9 "strings" 9 "strings"
10 10
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 return templates.Args{ 42 return templates.Args{
43 "AppVersion": strings.Split(info.VersionID(c), ".")[0], 43 "AppVersion": strings.Split(info.VersionID(c), ".")[0],
44 "IsAnonymous": auth.CurrentIdentity(c) == identi ty.AnonymousIdentity, 44 "IsAnonymous": auth.CurrentIdentity(c) == identi ty.AnonymousIdentity,
45 "User": auth.CurrentUser(c), 45 "User": auth.CurrentUser(c),
46 "LoginURL": loginURL, 46 "LoginURL": loginURL,
47 "LogoutURL": logoutURL, 47 "LogoutURL": logoutURL,
48 "CurrentTime": clock.Now(c), 48 "CurrentTime": clock.Now(c),
49 "Analytics": analytics.Snippet(c), 49 "Analytics": analytics.Snippet(c),
50 "RequestID": info.RequestID(c), 50 "RequestID": info.RequestID(c),
51 "Request": r,
51 }, nil 52 }, nil
52 }, 53 },
53 FuncMap: funcMap, 54 FuncMap: funcMap,
54 } 55 }
55 } 56 }
56 57
57 // Base returns the basic LUCI appengine middlewares. 58 // Base returns the basic LUCI appengine middlewares.
58 func Base() router.MiddlewareChain { 59 func Base() router.MiddlewareChain {
59 methods := auth.Authenticator{ 60 methods := auth.Authenticator{
60 &server.OAuth2Method{Scopes: []string{server.EmailScope}}, 61 &server.OAuth2Method{Scopes: []string{server.EmailScope}},
(...skipping 22 matching lines...) Expand all
83 c.Context = WithRequest(c.Context, c.Request) 84 c.Context = WithRequest(c.Context, c.Request)
84 next(c) 85 next(c)
85 } 86 }
86 87
87 func getRequest(c context.Context) *http.Request { 88 func getRequest(c context.Context) *http.Request {
88 if req, ok := c.Value(&requestKey).(*http.Request); ok { 89 if req, ok := c.Value(&requestKey).(*http.Request); ok {
89 return req 90 return req
90 } 91 }
91 panic("No http.request found in context") 92 panic("No http.request found in context")
92 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698