All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cc.voox.graphql.visibility.CustomFieldVisibility Maven / Gradle / Ivy

There is a newer version: 1.2.1
Show newest version
package cc.voox.graphql.visibility;

import graphql.schema.GraphQLFieldDefinition;
import graphql.schema.GraphQLFieldsContainer;
import graphql.schema.visibility.GraphqlFieldVisibility;

import java.util.Collections;
import java.util.List;

//class CustomFieldVisibility implements GraphqlFieldVisibility {
//
//    final YourUserAccessService userAccessService;
//
//    CustomFieldVisibility(YourUserAccessService userAccessService) {
//        this.userAccessService = userAccessService;
//    }
//
//    @Override
//    public List getFieldDefinitions(GraphQLFieldsContainer fieldsContainer) {
//        if ("AdminType".equals(fieldsContainer.getName())) {
//            if (!userAccessService.isAdminUser()) {
//                return Collections.emptyList();
//            }
//        }
//        return fieldsContainer.getFieldDefinitions();
//    }
//
//    @Override
//    public GraphQLFieldDefinition getFieldDefinition(GraphQLFieldsContainer fieldsContainer, String fieldName) {
//        if ("AdminType".equals(fieldsContainer.getName())) {
//            if (!userAccessService.isAdminUser()) {
//                return null;
//            }
//        }
//        return fieldsContainer.getFieldDefinition(fieldName);
//    }
//}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy