Line data Source code
1 : // Copyright (C) 2010 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server.project; 16 : 17 : import static com.google.inject.Scopes.SINGLETON; 18 : 19 : import com.google.common.collect.ImmutableSet; 20 : import com.google.gerrit.entities.AccountGroup; 21 : import com.google.gerrit.entities.GroupReference; 22 : import com.google.gerrit.extensions.config.FactoryModule; 23 : import com.google.gerrit.server.config.AdministrateServerGroups; 24 : import com.google.gerrit.server.config.AdministrateServerGroupsProvider; 25 : import com.google.gerrit.server.config.GitReceivePackGroups; 26 : import com.google.gerrit.server.config.GitReceivePackGroupsProvider; 27 : import com.google.gerrit.server.config.GitUploadPackGroups; 28 : import com.google.gerrit.server.config.GitUploadPackGroupsProvider; 29 : import com.google.inject.TypeLiteral; 30 : import java.util.Set; 31 : 32 152 : public class AccessControlModule extends FactoryModule { 33 : @Override 34 : protected void configure() { 35 152 : bind(new TypeLiteral<ImmutableSet<GroupReference>>() {}) 36 152 : .annotatedWith(AdministrateServerGroups.class) 37 152 : .toProvider(AdministrateServerGroupsProvider.class) 38 152 : .in(SINGLETON); 39 : 40 152 : bind(new TypeLiteral<Set<AccountGroup.UUID>>() {}) 41 152 : .annotatedWith(GitUploadPackGroups.class) 42 152 : .toProvider(GitUploadPackGroupsProvider.class) 43 152 : .in(SINGLETON); 44 : 45 152 : bind(new TypeLiteral<Set<AccountGroup.UUID>>() {}) 46 152 : .annotatedWith(GitReceivePackGroups.class) 47 152 : .toProvider(GitReceivePackGroupsProvider.class) 48 152 : .in(SINGLETON); 49 152 : } 50 : }