INNER CODE UNIT · Go

filterFields

movio/bramble · auth.go:259

func filterFields(path []string, ss ast.SelectionSet, allowedFields AllowedFields) (ast.SelectionSet, gqlerror.List) {
	res := make(ast.SelectionSet, 0, len(ss))
	var errs gqlerror.List

	if allowedFields.AllowAll {
		return ss, nil
	}

	for _, s := range ss {
		switch s := s.(type) {
		case *ast.Field:
			if allowed, fieldsPerms := allowedFields.IsAllowed(s.Name); allowed {
				if fieldsPerms.AllowAll {
					res = append(res, s)
					continue
				}

				var ferrs gqlerror.List

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…