INNER CODE UNIT · Go
func
movio/bramble · auth.go:105
func (o OperationPermissions) MarshalJSON() ([]byte, error) {
m := make(map[string]AllowedFields)
if o.AllowedRootQueryFields.AllowAll || o.AllowedRootQueryFields.AllowedSubfields != nil {
m["query"] = o.AllowedRootQueryFields
}
if o.AllowedRootMutationFields.AllowAll || o.AllowedRootMutationFields.AllowedSubfields != nil {
m["mutation"] = o.AllowedRootMutationFields
}
if o.AllowedRootSubscriptionFields.AllowAll || o.AllowedRootSubscriptionFields.AllowedSubfields != nil {
m["subscription"] = o.AllowedRootSubscriptionFields
}
return json.Marshal(m)
}
// FilterAuthorizedFields filters the operation's selection set and removes all
// fields that are not explicitly authorized.
// Every unauthorized field is returned as an error.
func (o *OperationPermissions) FilterAuthorizedFields(op *ast.OperationDefinition) gqlerror.List {