001// -------------------------------------------------------------------------------- 002// Copyright 2002-2024 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.accounting.server.graphql; 018 019import com.echothree.control.user.accounting.server.command.GetCurrenciesCommand; 020import com.echothree.control.user.accounting.server.command.GetCurrencyCommand; 021import com.echothree.control.user.accounting.server.command.GetGlAccountCategoriesCommand; 022import com.echothree.control.user.accounting.server.command.GetGlAccountCategoryCommand; 023import com.echothree.control.user.accounting.server.command.GetGlAccountClassCommand; 024import com.echothree.control.user.accounting.server.command.GetGlAccountClassesCommand; 025import com.echothree.control.user.accounting.server.command.GetGlAccountCommand; 026import com.echothree.control.user.accounting.server.command.GetGlAccountTypeCommand; 027import com.echothree.control.user.accounting.server.command.GetGlAccountTypesCommand; 028import com.echothree.control.user.accounting.server.command.GetGlAccountsCommand; 029import com.echothree.control.user.accounting.server.command.GetGlResourceTypeCommand; 030import com.echothree.control.user.accounting.server.command.GetGlResourceTypesCommand; 031import com.echothree.control.user.accounting.server.command.GetItemAccountingCategoriesCommand; 032import com.echothree.control.user.accounting.server.command.GetItemAccountingCategoryCommand; 033import com.echothree.control.user.accounting.server.command.GetSymbolPositionCommand; 034import com.echothree.control.user.accounting.server.command.GetSymbolPositionsCommand; 035import com.echothree.model.control.graphql.server.util.BaseGraphQl; 036import graphql.schema.DataFetchingEnvironment; 037 038public interface AccountingSecurityUtils { 039 040 static boolean getHasSymbolPositionAccess(final DataFetchingEnvironment env) { 041 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetSymbolPositionCommand.class); 042 } 043 044 static boolean getHasSymbolPositionsAccess(final DataFetchingEnvironment env) { 045 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetSymbolPositionsCommand.class); 046 } 047 048 static boolean getHasCurrencyAccess(final DataFetchingEnvironment env) { 049 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetCurrencyCommand.class); 050 } 051 052 static boolean getHasCurrenciesAccess(final DataFetchingEnvironment env) { 053 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetCurrenciesCommand.class); 054 } 055 056 static boolean getHasItemAccountingCategoryAccess(final DataFetchingEnvironment env) { 057 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetItemAccountingCategoryCommand.class); 058 } 059 060 static boolean getHasItemAccountingCategoriesAccess(final DataFetchingEnvironment env) { 061 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetItemAccountingCategoriesCommand.class); 062 } 063 064 static boolean getHasGlAccountAccess(final DataFetchingEnvironment env) { 065 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetGlAccountCommand.class); 066 } 067 068 static boolean getHasGlAccountsAccess(final DataFetchingEnvironment env) { 069 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetGlAccountsCommand.class); 070 } 071 072 static boolean getHasGlAccountTypeAccess(final DataFetchingEnvironment env) { 073 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetGlAccountTypeCommand.class); 074 } 075 076 static boolean getHasGlAccountTypesAccess(final DataFetchingEnvironment env) { 077 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetGlAccountTypesCommand.class); 078 } 079 080 static boolean getHasGlAccountClassAccess(final DataFetchingEnvironment env) { 081 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetGlAccountClassCommand.class); 082 } 083 084 static boolean getHasGlAccountClassesAccess(final DataFetchingEnvironment env) { 085 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetGlAccountClassesCommand.class); 086 } 087 088 static boolean getHasGlAccountCategoryAccess(final DataFetchingEnvironment env) { 089 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetGlAccountCategoryCommand.class); 090 } 091 092 static boolean getHasGlAccountCategoriesAccess(final DataFetchingEnvironment env) { 093 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetGlAccountCategoriesCommand.class); 094 } 095 096 static boolean getHasGlResourceTypeAccess(final DataFetchingEnvironment env) { 097 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetGlResourceTypeCommand.class); 098 } 099 100 static boolean getHasGlResourceTypesAccess(final DataFetchingEnvironment env) { 101 return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetGlResourceTypesCommand.class); 102 } 103 104}