001// --------------------------------------------------------------------------------
002// Copyright 2002-2026 Echo Three, LLC
003//
004// Licensed under the Apache License, Version 2.0 (the "License");
005// you may not use this file except in compliance with the License.
006// You may obtain a copy of the License at
007//
008//     http://www.apache.org/licenses/LICENSE-2.0
009//
010// Unless required by applicable law or agreed to in writing, software
011// distributed under the License is distributed on an "AS IS" BASIS,
012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013// See the License for the specific language governing permissions and
014// limitations under the License.
015// --------------------------------------------------------------------------------
016
017package com.echothree.model.control.warehouse.server.graphql;
018
019import com.echothree.control.user.warehouse.server.command.GetLocationCommand;
020import com.echothree.control.user.warehouse.server.command.GetLocationNameElementCommand;
021import com.echothree.control.user.warehouse.server.command.GetLocationNameElementsCommand;
022import com.echothree.control.user.warehouse.server.command.GetLocationTypeCommand;
023import com.echothree.control.user.warehouse.server.command.GetLocationTypesCommand;
024import com.echothree.control.user.warehouse.server.command.GetLocationUseTypeCommand;
025import com.echothree.control.user.warehouse.server.command.GetLocationUseTypesCommand;
026import com.echothree.control.user.warehouse.server.command.GetLocationsCommand;
027import com.echothree.control.user.warehouse.server.command.GetWarehouseCommand;
028import com.echothree.control.user.warehouse.server.command.GetWarehouseTypeCommand;
029import com.echothree.control.user.warehouse.server.command.GetWarehouseTypesCommand;
030import com.echothree.control.user.warehouse.server.command.GetWarehousesCommand;
031import com.echothree.model.control.graphql.server.util.BaseGraphQl;
032import graphql.schema.DataFetchingEnvironment;
033
034public interface WarehouseSecurityUtils {
035
036    static boolean getHasWarehouseAccess(final DataFetchingEnvironment env) {
037        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetWarehouseCommand.class);
038    }
039
040    static boolean getHasWarehousesAccess(final DataFetchingEnvironment env) {
041        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetWarehousesCommand.class);
042    }
043
044    static boolean getHasWarehouseTypeAccess(final DataFetchingEnvironment env) {
045        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetWarehouseTypeCommand.class);
046    }
047
048    static boolean getHasWarehouseTypesAccess(final DataFetchingEnvironment env) {
049        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetWarehouseTypesCommand.class);
050    }
051
052    static boolean getHasLocationTypeAccess(final DataFetchingEnvironment env) {
053        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetLocationTypeCommand.class);
054    }
055
056    static boolean getHasLocationTypesAccess(final DataFetchingEnvironment env) {
057        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetLocationTypesCommand.class);
058    }
059
060    static boolean getHasLocationNameElementAccess(final DataFetchingEnvironment env) {
061        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetLocationNameElementCommand.class);
062    }
063
064    static boolean getHasLocationNameElementsAccess(final DataFetchingEnvironment env) {
065        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetLocationNameElementsCommand.class);
066    }
067
068    static boolean getHasLocationUseTypeAccess(final DataFetchingEnvironment env) {
069        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetLocationUseTypeCommand.class);
070    }
071
072    static boolean getHasLocationUseTypesAccess(final DataFetchingEnvironment env) {
073        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetLocationUseTypesCommand.class);
074    }
075
076    static boolean getHasLocationAccess(final DataFetchingEnvironment env) {
077        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetLocationCommand.class);
078    }
079
080    static boolean getHasLocationsAccess(final DataFetchingEnvironment env) {
081        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetLocationsCommand.class);
082    }
083
084}