cc.voox.graphql.visibility.CustomFieldVisibility Maven / Gradle / Ivy
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);
// }
//}