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

Side by Side Diff: milo/appengine/buildbot/master.go

Issue 2748073006: Milo Refactor: Remove theme support (Closed)
Patch Set: Fix builder.html pointer Created 3 years, 9 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 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 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 buildbot 5 package buildbot
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "compress/gzip" 9 "compress/gzip"
10 "encoding/json" 10 "encoding/json"
11 "fmt" 11 "fmt"
12 "sort" 12 "sort"
13 "time" 13 "time"
14 14
15 ds "github.com/luci/gae/service/datastore" 15 ds "github.com/luci/gae/service/datastore"
16 "github.com/luci/luci-go/common/logging" 16 "github.com/luci/luci-go/common/logging"
17 "github.com/luci/luci-go/milo/api/resp" 17 "github.com/luci/luci-go/milo/api/resp"
18 » "github.com/luci/luci-go/milo/appengine/settings" 18 » "github.com/luci/luci-go/milo/appengine/common"
19 "github.com/luci/luci-go/server/auth" 19 "github.com/luci/luci-go/server/auth"
20 "github.com/luci/luci-go/server/auth/identity" 20 "github.com/luci/luci-go/server/auth/identity"
21 21
22 "golang.org/x/net/context" 22 "golang.org/x/net/context"
23 ) 23 )
24 24
25 func decodeMasterEntry( 25 func decodeMasterEntry(
26 c context.Context, entry *buildbotMasterEntry, master *buildbotMaster) e rror { 26 c context.Context, entry *buildbotMasterEntry, master *buildbotMaster) e rror {
27 27
28 reader, err := gzip.NewReader(bytes.NewReader(entry.Data)) 28 reader, err := gzip.NewReader(bytes.NewReader(entry.Data))
(...skipping 21 matching lines...) Expand all
50 if cu.Identity == identity.AnonymousIdentity { 50 if cu.Identity == identity.AnonymousIdentity {
51 return errNotAuth 51 return errNotAuth
52 } 52 }
53 return errMasterNotFound 53 return errMasterNotFound
54 case err != nil: 54 case err != nil:
55 return err 55 return err
56 } 56 }
57 57
58 // Do the ACL check if the entry is internal. 58 // Do the ACL check if the entry is internal.
59 if internal { 59 if internal {
60 » » allowed, err := settings.IsAllowedInternal(c) 60 » » allowed, err := common.IsAllowedInternal(c)
61 if err != nil { 61 if err != nil {
62 return err 62 return err
63 } 63 }
64 if !allowed { 64 if !allowed {
65 if cu.Identity == identity.AnonymousIdentity { 65 if cu.Identity == identity.AnonymousIdentity {
66 return errNotAuth 66 return errNotAuth
67 } 67 }
68 return errMasterNotFound 68 return errMasterNotFound
69 } 69 }
70 } 70 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 if err != nil { 109 if err != nil {
110 return nil, err 110 return nil, err
111 } 111 }
112 112
113 // Add each builder from each master entry into the result. 113 // Add each builder from each master entry into the result.
114 // TODO(hinoka): FanInOut this? 114 // TODO(hinoka): FanInOut this?
115 for _, entry := range entries { 115 for _, entry := range entries {
116 if entry.Internal { 116 if entry.Internal {
117 // Bypass the master if it's an internal master and the user is not 117 // Bypass the master if it's an internal master and the user is not
118 // part of the buildbot-private project. 118 // part of the buildbot-private project.
119 » » » allowed, err := settings.IsAllowedInternal(c) 119 » » » allowed, err := common.IsAllowedInternal(c)
120 if err != nil { 120 if err != nil {
121 logging.WithError(err).Errorf(c, "Could not proc ess master %s", entry.Name) 121 logging.WithError(err).Errorf(c, "Could not proc ess master %s", entry.Name)
122 return nil, err 122 return nil, err
123 } 123 }
124 if !allowed { 124 if !allowed {
125 continue 125 continue
126 } 126 }
127 } 127 }
128 master := &buildbotMaster{} 128 master := &buildbotMaster{}
129 err = decodeMasterEntry(c, entry, master) 129 err = decodeMasterEntry(c, entry, master)
(...skipping 13 matching lines...) Expand all
143 Label: bn, 143 Label: bn,
144 // Go templates escapes this for us, and also 144 // Go templates escapes this for us, and also
145 // slashes are not allowed in builder names. 145 // slashes are not allowed in builder names.
146 URL: fmt.Sprintf("/buildbot/%s/%s", entry.Name, bn), 146 URL: fmt.Sprintf("/buildbot/%s/%s", entry.Name, bn),
147 }) 147 })
148 } 148 }
149 result.BuilderGroups = append(result.BuilderGroups, ml) 149 result.BuilderGroups = append(result.BuilderGroups, ml)
150 } 150 }
151 return result, nil 151 return result, nil
152 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698