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

Unified Diff: appengine/logdog/coordinator/hierarchy/project.go

Issue 1971493003: LogDog: Project READ access for user endpoints. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-service-config
Patch Set: Added project archival parametrs, better support. 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 side-by-side diff with in-line comments
Download patch
Index: appengine/logdog/coordinator/hierarchy/project.go
diff --git a/appengine/logdog/coordinator/hierarchy/project.go b/appengine/logdog/coordinator/hierarchy/project.go
index 70398b4c618acd0b6770c50feebbea1d0e9b4744..bd2bc036324650dbdaae38e7d97bdfa40c270c05 100644
--- a/appengine/logdog/coordinator/hierarchy/project.go
+++ b/appengine/logdog/coordinator/hierarchy/project.go
@@ -6,7 +6,6 @@ package hierarchy
import (
"github.com/luci/luci-go/appengine/logdog/coordinator"
- "github.com/luci/luci-go/appengine/logdog/coordinator/config"
luciConfig "github.com/luci/luci-go/common/config"
log "github.com/luci/luci-go/common/logging"
"golang.org/x/net/context"
@@ -19,32 +18,12 @@ func getProjects(c context.Context, r *Request) (*List, error) {
return &l, nil
}
- projects, err := config.UserProjects(c)
- if err != nil {
- log.WithError(err).Errorf(c, "Failed to get user projects.")
- return nil, err
- }
-
- // Get all current datastore namespaces.
- nsProjects, err := coordinator.AllProjectsWithNamespaces(c)
+ // Get all user-accessible active projects.
+ projects, err := coordinator.ActiveProjects(c, true)
if err != nil {
// If there is an error, we will refrain from filtering projects.
- log.WithError(err).Warningf(c, "Failed to get namespace project list.")
- } else {
- // Only list projects that have datastore namespaces.
- lookup := make(map[luciConfig.ProjectName]struct{}, len(nsProjects))
- for _, proj := range nsProjects {
- lookup[proj] = struct{}{}
- }
-
- pos := 0
- for _, proj := range projects {
- if _, ok := lookup[proj]; ok {
- projects[pos] = proj
- pos++
- }
- }
- projects = projects[:pos]
+ log.WithError(err).Warningf(c, "Failed to get project list.")
+ return nil, err
}
next := luciConfig.ProjectName(r.Next)

Powered by Google App Engine
This is Rietveld 408576698