Search in sources :

Example 46 with ProjectConfig

use of com.google.gerrit.server.git.ProjectConfig in project gerrit by GerritCodeReview.

the class ImpersonationIT method removeRunAs.

private void removeRunAs() throws Exception {
    ProjectConfig cfg = projectCache.checkedGet(allProjects).getConfig();
    Util.remove(cfg, GlobalCapability.RUN_AS, systemGroupBackend.getGroup(ANONYMOUS_USERS).getUUID());
    saveProjectConfig(allProjects, cfg);
}
Also used : ProjectConfig(com.google.gerrit.server.git.ProjectConfig)

Example 47 with ProjectConfig

use of com.google.gerrit.server.git.ProjectConfig in project gerrit by GerritCodeReview.

the class AbstractSubmitByRebase method submitWithRebaseWithoutAddPatchSetPermission.

@Test
@TestProjectInput(useContentMerge = InheritableBoolean.TRUE)
public void submitWithRebaseWithoutAddPatchSetPermission() throws Exception {
    ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
    Util.block(cfg, Permission.ADD_PATCH_SET, REGISTERED_USERS, "refs/*");
    Util.allow(cfg, Permission.SUBMIT, REGISTERED_USERS, "refs/heads/*");
    Util.allow(cfg, Permission.forLabel(Util.codeReview().getName()), -2, 2, REGISTERED_USERS, "refs/heads/*");
    saveProjectConfig(project, cfg);
    submitWithRebase(user);
}
Also used : ProjectConfig(com.google.gerrit.server.git.ProjectConfig) TestProjectInput(com.google.gerrit.acceptance.TestProjectInput) Test(org.junit.Test)

Example 48 with ProjectConfig

use of com.google.gerrit.server.git.ProjectConfig in project gerrit by GerritCodeReview.

the class ImpersonationIT method allowSubmitOnBehalfOf.

private void allowSubmitOnBehalfOf() throws Exception {
    ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
    String heads = "refs/heads/*";
    AccountGroup.UUID uuid = systemGroupBackend.getGroup(REGISTERED_USERS).getUUID();
    Util.allow(cfg, Permission.SUBMIT_AS, uuid, heads);
    Util.allow(cfg, Permission.SUBMIT, uuid, heads);
    LabelType codeReviewType = Util.codeReview();
    Util.allow(cfg, Permission.forLabel(codeReviewType.getName()), -2, 2, uuid, heads);
    saveProjectConfig(project, cfg);
}
Also used : ProjectConfig(com.google.gerrit.server.git.ProjectConfig) AccountGroup(com.google.gerrit.reviewdb.client.AccountGroup) LabelType(com.google.gerrit.common.data.LabelType)

Example 49 with ProjectConfig

use of com.google.gerrit.server.git.ProjectConfig in project gerrit by GerritCodeReview.

the class CustomLabelIT method setUp.

@Before
public void setUp() throws Exception {
    ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
    AccountGroup.UUID anonymousUsers = systemGroupBackend.getGroup(ANONYMOUS_USERS).getUUID();
    Util.allow(cfg, Permission.forLabel(label.getName()), -1, 1, anonymousUsers, "refs/heads/*");
    Util.allow(cfg, Permission.forLabel(P.getName()), 0, 1, anonymousUsers, "refs/heads/*");
    saveProjectConfig(project, cfg);
    eventListenerRegistration = source.add(new CommentAddedListener() {

        @Override
        public void onCommentAdded(Event event) {
            lastCommentAddedEvent = event;
        }
    });
}
Also used : ProjectConfig(com.google.gerrit.server.git.ProjectConfig) AccountGroup(com.google.gerrit.reviewdb.client.AccountGroup) CommentAddedListener(com.google.gerrit.extensions.events.CommentAddedListener) Before(org.junit.Before)

Example 50 with ProjectConfig

use of com.google.gerrit.server.git.ProjectConfig in project gerrit by GerritCodeReview.

the class CustomLabelIT method saveLabelConfig.

private void saveLabelConfig() throws Exception {
    ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
    cfg.getLabelSections().put(label.getName(), label);
    cfg.getLabelSections().put(P.getName(), P);
    saveProjectConfig(project, cfg);
}
Also used : ProjectConfig(com.google.gerrit.server.git.ProjectConfig)

Aggregations

ProjectConfig (com.google.gerrit.server.git.ProjectConfig)64 MetaDataUpdate (com.google.gerrit.server.git.MetaDataUpdate)23 AccessSection (com.google.gerrit.common.data.AccessSection)15 Project (com.google.gerrit.reviewdb.client.Project)14 ConfigInvalidException (org.eclipse.jgit.errors.ConfigInvalidException)14 AccountGroup (com.google.gerrit.reviewdb.client.AccountGroup)12 Permission (com.google.gerrit.common.data.Permission)10 PermissionRule (com.google.gerrit.common.data.PermissionRule)10 IOException (java.io.IOException)10 Repository (org.eclipse.jgit.lib.Repository)9 LabelType (com.google.gerrit.common.data.LabelType)8 Test (org.junit.Test)8 ResourceConflictException (com.google.gerrit.extensions.restapi.ResourceConflictException)7 RepositoryNotFoundException (org.eclipse.jgit.errors.RepositoryNotFoundException)7 Before (org.junit.Before)7 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)6 GroupReference (com.google.gerrit.common.data.GroupReference)6 OrmException (com.google.gwtorm.server.OrmException)6 ResourceNotFoundException (com.google.gerrit.extensions.restapi.ResourceNotFoundException)5 AuthException (com.google.gerrit.extensions.restapi.AuthException)4