| Index: logdog/appengine/coordinator/project.go
|
| diff --git a/logdog/appengine/coordinator/project.go b/logdog/appengine/coordinator/project.go
|
| index 50360a0a366396d7805ed5858ea62a4ee394ee39..13139ba732e724501c4eecea5c4bd620f1791c22 100644
|
| --- a/logdog/appengine/coordinator/project.go
|
| +++ b/logdog/appengine/coordinator/project.go
|
| @@ -8,10 +8,9 @@ import (
|
| "strings"
|
|
|
| "github.com/luci/gae/service/info"
|
| - luciConfig "github.com/luci/luci-go/common/config"
|
| - log "github.com/luci/luci-go/common/logging"
|
| + commonConfig "github.com/luci/luci-go/common/config"
|
| "github.com/luci/luci-go/logdog/api/config/svcconfig"
|
| - "github.com/luci/luci-go/logdog/appengine/coordinator/config"
|
| +
|
| "golang.org/x/net/context"
|
| )
|
|
|
| @@ -23,7 +22,7 @@ const (
|
|
|
| // ProjectNamespace returns the AppEngine namespace for a given luci-config
|
| // project name.
|
| -func ProjectNamespace(project luciConfig.ProjectName) string {
|
| +func ProjectNamespace(project commonConfig.ProjectName) string {
|
| return projectNamespacePrefix + string(project)
|
| }
|
|
|
| @@ -32,11 +31,11 @@ func ProjectNamespace(project luciConfig.ProjectName) string {
|
| //
|
| // If the namespace does not have a project namespace prefix, this function
|
| // will return an empty string.
|
| -func ProjectFromNamespace(ns string) luciConfig.ProjectName {
|
| +func ProjectFromNamespace(ns string) commonConfig.ProjectName {
|
| if !strings.HasPrefix(ns, projectNamespacePrefix) {
|
| return ""
|
| }
|
| - return luciConfig.ProjectName(ns[len(projectNamespacePrefix):])
|
| + return commonConfig.ProjectName(ns[len(projectNamespacePrefix):])
|
| }
|
|
|
| // CurrentProject returns the current project based on the currently-loaded
|
| @@ -44,7 +43,7 @@ func ProjectFromNamespace(ns string) luciConfig.ProjectName {
|
| //
|
| // If there is no current namespace, or if the current namespace is not a valid
|
| // project namespace, an empty string will be returned.
|
| -func CurrentProject(c context.Context) luciConfig.ProjectName {
|
| +func CurrentProject(c context.Context) commonConfig.ProjectName {
|
| if ns := info.GetNamespace(c); ns != "" {
|
| return ProjectFromNamespace(ns)
|
| }
|
| @@ -59,36 +58,3 @@ func CurrentProject(c context.Context) luciConfig.ProjectName {
|
| func CurrentProjectConfig(c context.Context) (*svcconfig.ProjectConfig, error) {
|
| return GetServices(c).ProjectConfig(c, CurrentProject(c))
|
| }
|
| -
|
| -// ActiveUserProjects returns a full list of all config service projects with
|
| -// LogDog project configurations that the current user has READ access to.
|
| -//
|
| -// TODO: Load project configs and all project configs lists from datastore. Add
|
| -// a background cron job to periodically update these lists from luci-config.
|
| -// This should be a generic config service capability.
|
| -func ActiveUserProjects(c context.Context) (map[luciConfig.ProjectName]*svcconfig.ProjectConfig, error) {
|
| - allPcfgs, err := config.AllProjectConfigs(c)
|
| - if err != nil {
|
| - return nil, err
|
| - }
|
| -
|
| - for project, pcfg := range allPcfgs {
|
| - // Verify user READ access.
|
| - if err := IsProjectReader(c, pcfg); err != nil {
|
| - delete(allPcfgs, project)
|
| -
|
| - // If it is a membership error, prune this project and continue.
|
| - // Otherwise, forward the error.
|
| - if !IsMembershipError(err) {
|
| - // No configuration for this project, the configuration is invalid, or
|
| - // the user didn't have access. Remove it from the list.
|
| - log.Fields{
|
| - log.ErrorKey: err,
|
| - "project": project,
|
| - }.Errorf(c, "Failed to check project.")
|
| - return nil, err
|
| - }
|
| - }
|
| - }
|
| - return allPcfgs, nil
|
| -}
|
|
|