BREAKING CHANGE: super-graph/core now defaults to allow all in anon role

This commit is contained in:
Vikram Rangnekar
2020-05-28 00:07:01 -04:00
parent 2241364d00
commit 1fb7f0e6c8
15 changed files with 465 additions and 291 deletions

View File

@ -6,7 +6,8 @@ import (
)
type Config struct {
Blocklist []string
DefaultBlock bool
Blocklist []string
}
type QueryConfig struct {

View File

@ -172,6 +172,8 @@ const (
type Compiler struct {
tr map[string]map[string]*trval
bl map[string]struct{}
defBlock bool
}
var expPool = sync.Pool{
@ -179,7 +181,7 @@ var expPool = sync.Pool{
}
func NewCompiler(c Config) (*Compiler, error) {
co := &Compiler{}
co := &Compiler{defBlock: c.DefaultBlock}
co.tr = make(map[string]map[string]*trval)
co.bl = make(map[string]struct{}, len(c.Blocklist))
@ -358,7 +360,7 @@ func (com *Compiler) compileQuery(qc *QCode, op *Operation, role string) error {
}
} else if role == "anon" {
skipRender = true
skipRender = com.defBlock
}
selects = append(selects, Select{