Skip to content

Commit

Permalink
User with member role in project should also
Browse files Browse the repository at this point in the history
be able to access contrial_cluster and its
endpoints resources. frontend depednds on this
to decide to display setup wizard.

Marked as partial fix, as this fix is temporary.
Permanant fix is to implment global access with
global share table.

Change-Id: I2fe5db92dd9f8f1b126c0010e9510f56ae7417dd
Partial-Bug: 1787949
  • Loading branch information
cijohnson committed Oct 12, 2018
1 parent d78352e commit 7e0149e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/db/basedb/query_builder.go
Expand Up @@ -21,6 +21,9 @@ const (
POSTGRES = "postgres"
)

//TODO(ijohnson) remove when global share table is supported.
var globalResources = []string{"contrail_cluster", "endpoint"}

// QueryBuilder builds list query.
type QueryBuilder struct {
Dialect
Expand Down Expand Up @@ -271,7 +274,8 @@ func (qb *QueryBuilder) buildAuthQuery(ctx *queryContext) {
spec := ctx.spec
where := []string{}

if !auth.IsAdmin() {
//TODO(ijohnson) support global share table
if !auth.IsAdmin() && !common.ContainsString(globalResources, qb.Table) {
ctx.values = append(ctx.values, auth.ProjectID())
where = append(where, qb.Quote(qb.TableAlias, "owner")+" = "+qb.Placeholder(len(ctx.values)))
if spec.Shared {
Expand Down

0 comments on commit 7e0149e

Please sign in to comment.