001// --------------------------------------------------------------------------------
002// Copyright 2002-2025 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.content.server.graphql;
018
019import com.echothree.control.user.content.server.command.GetContentCatalogCommand;
020import com.echothree.control.user.content.server.command.GetContentCatalogItemCommand;
021import com.echothree.control.user.content.server.command.GetContentCatalogItemsCommand;
022import com.echothree.control.user.content.server.command.GetContentCatalogsCommand;
023import com.echothree.control.user.content.server.command.GetContentCategoriesCommand;
024import com.echothree.control.user.content.server.command.GetContentCategoryCommand;
025import com.echothree.control.user.content.server.command.GetContentCategoryItemCommand;
026import com.echothree.control.user.content.server.command.GetContentCategoryItemsCommand;
027import com.echothree.control.user.content.server.command.GetContentCollectionCommand;
028import com.echothree.control.user.content.server.command.GetContentPageAreaCommand;
029import com.echothree.control.user.content.server.command.GetContentPageAreasCommand;
030import com.echothree.control.user.content.server.command.GetContentPageCommand;
031import com.echothree.control.user.content.server.command.GetContentPageLayoutAreaCommand;
032import com.echothree.control.user.content.server.command.GetContentPageLayoutAreasCommand;
033import com.echothree.control.user.content.server.command.GetContentPageLayoutCommand;
034import com.echothree.control.user.content.server.command.GetContentPageLayoutsCommand;
035import com.echothree.control.user.content.server.command.GetContentPagesCommand;
036import com.echothree.control.user.content.server.command.GetContentSectionCommand;
037import com.echothree.control.user.content.server.command.GetContentSectionsCommand;
038import com.echothree.model.control.graphql.server.util.BaseGraphQl;
039import graphql.schema.DataFetchingEnvironment;
040
041public interface ContentSecurityUtils {
042
043    static boolean getHasContentCollectionAccess(final DataFetchingEnvironment env) {
044        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentCollectionCommand.class);
045    }
046    
047    static boolean getHasContentCatalogsAccess(final DataFetchingEnvironment env) {
048        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentCatalogsCommand.class);
049    }
050    
051    static boolean getHasContentCatalogAccess(final DataFetchingEnvironment env) {
052        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentCatalogCommand.class);
053    }
054    
055    static boolean getHasContentCatalogItemsAccess(final DataFetchingEnvironment env) {
056        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentCatalogItemsCommand.class);
057    }
058    
059    static boolean getHasContentCatalogItemAccess(final DataFetchingEnvironment env) {
060        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentCatalogItemCommand.class);
061    }
062
063    static boolean getHasContentCategoriesAccess(final DataFetchingEnvironment env) {
064        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentCategoriesCommand.class);
065    }
066        
067    static boolean getHasContentCategoryAccess(final DataFetchingEnvironment env) {
068        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentCategoryCommand.class);
069    }
070        
071     static boolean getHasContentCategoryItemsAccess(final DataFetchingEnvironment env) {
072        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentCategoryItemsCommand.class);
073    }
074    
075    static boolean getHasContentCategoryItemAccess(final DataFetchingEnvironment env) {
076        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentCategoryItemCommand.class);
077    }
078
079   static boolean getHasContentSectionsAccess(final DataFetchingEnvironment env) {
080        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentSectionsCommand.class);
081    }
082
083    static boolean getHasContentSectionAccess(final DataFetchingEnvironment env) {
084        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentSectionCommand.class);
085    }
086
087    static boolean getHasContentPageLayoutsAccess(final DataFetchingEnvironment env) {
088        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentPageLayoutsCommand.class);
089    }
090
091    static boolean getHasContentPageLayoutAccess(final DataFetchingEnvironment env) {
092        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentPageLayoutCommand.class);
093    }
094
095    static boolean getHasContentPageLayoutAreasAccess(final DataFetchingEnvironment env) {
096        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentPageLayoutAreasCommand.class);
097    }
098
099    static boolean getHasContentPageLayoutAreaAccess(final DataFetchingEnvironment env) {
100        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentPageLayoutAreaCommand.class);
101    }
102
103    static boolean getHasContentPagesAccess(final DataFetchingEnvironment env) {
104        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentPagesCommand.class);
105    }
106
107    static boolean getHasContentPageAccess(final DataFetchingEnvironment env) {
108        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentPageCommand.class);
109    }
110
111    static boolean getHasContentPageAreasAccess(final DataFetchingEnvironment env) {
112        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentPageAreasCommand.class);
113    }
114
115    static boolean getHasContentPageAreaAccess(final DataFetchingEnvironment env) {
116        return BaseGraphQl.getGraphQlExecutionContext(env).hasAccess(GetContentPageAreaCommand.class);
117    }
118
119}