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.chain.server.graphql;
018
019import com.echothree.control.user.chain.server.command.GetChainActionCommand;
020import com.echothree.control.user.chain.server.command.GetChainActionSetCommand;
021import com.echothree.control.user.chain.server.command.GetChainActionSetsCommand;
022import com.echothree.control.user.chain.server.command.GetChainActionTypeCommand;
023import com.echothree.control.user.chain.server.command.GetChainActionTypesCommand;
024import com.echothree.control.user.chain.server.command.GetChainActionsCommand;
025import com.echothree.control.user.chain.server.command.GetChainCommand;
026import com.echothree.control.user.chain.server.command.GetChainKindCommand;
027import com.echothree.control.user.chain.server.command.GetChainKindsCommand;
028import com.echothree.control.user.chain.server.command.GetChainTypeCommand;
029import com.echothree.control.user.chain.server.command.GetChainTypesCommand;
030import com.echothree.control.user.chain.server.command.GetChainsCommand;
031import com.echothree.model.control.graphql.server.util.BaseGraphQl;
032import graphql.schema.DataFetchingEnvironment;
033
034public interface ChainSecurityUtils {
035
036    static boolean getHasChainKindsAccess(final DataFetchingEnvironment env) {
037        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetChainKindsCommand.class);
038    }
039
040    static boolean getHasChainKindAccess(final DataFetchingEnvironment env) {
041        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetChainKindCommand.class);
042    }
043
044    static boolean getHasChainTypesAccess(final DataFetchingEnvironment env) {
045        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetChainTypesCommand.class);
046    }
047
048    static boolean getHasChainTypeAccess(final DataFetchingEnvironment env) {
049        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetChainTypeCommand.class);
050    }
051
052    static boolean getHasChainsAccess(final DataFetchingEnvironment env) {
053        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetChainsCommand.class);
054    }
055
056    static boolean getHasChainAccess(final DataFetchingEnvironment env) {
057        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetChainCommand.class);
058    }
059
060    static boolean getHasChainActionSetsAccess(final DataFetchingEnvironment env) {
061        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetChainActionSetsCommand.class);
062    }
063
064    static boolean getHasChainActionSetAccess(final DataFetchingEnvironment env) {
065        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetChainActionSetCommand.class);
066    }
067
068    static boolean getHasChainActionTypesAccess(final DataFetchingEnvironment env) {
069        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetChainActionTypesCommand.class);
070    }
071
072    static boolean getHasChainActionTypeAccess(final DataFetchingEnvironment env) {
073        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetChainActionTypeCommand.class);
074    }
075
076    static boolean getHasChainActionsAccess(final DataFetchingEnvironment env) {
077        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetChainActionsCommand.class);
078    }
079
080    static boolean getHasChainActionAccess(final DataFetchingEnvironment env) {
081        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetChainActionCommand.class);
082    }
083
084}