import org.sonar.server.notification.email.EmailNotificationChannel;
import org.sonar.server.organization.DefaultOrganizationProviderImpl;
import org.sonar.server.permission.GroupPermissionChanger;
-import org.sonar.server.permission.PermissionService;
+import org.sonar.server.permission.PermissionTemplateService;
import org.sonar.server.permission.PermissionUpdater;
import org.sonar.server.permission.UserPermissionChanger;
import org.sonar.server.permission.index.PermissionIndexer;
// permissions
PermissionRepository.class,
- PermissionService.class,
+ PermissionTemplateService.class,
PermissionUpdater.class,
UserPermissionChanger.class,
GroupPermissionChanger.class,
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ResourceDao;
import org.sonar.db.component.ResourceDto;
-import org.sonar.server.permission.PermissionService;
+import org.sonar.server.permission.PermissionTemplateService;
import org.sonar.server.util.RubyUtils;
public class DefaultRubyComponentService implements RubyComponentService {
private final DbClient dbClient;
private final ResourceDao resourceDao;
private final ComponentService componentService;
- private final PermissionService permissionService;
+ private final PermissionTemplateService permissionTemplateService;
- public DefaultRubyComponentService(DbClient dbClient, ResourceDao resourceDao, ComponentService componentService, PermissionService permissionService) {
+ public DefaultRubyComponentService(DbClient dbClient, ResourceDao resourceDao, ComponentService componentService, PermissionTemplateService permissionTemplateService) {
this.dbClient = dbClient;
this.resourceDao = resourceDao;
this.componentService = componentService;
- this.permissionService = permissionService;
+ this.permissionTemplateService = permissionTemplateService;
}
@Override
public long createComponent(DbSession dbSession, String key, @Nullable String branch, String name, @Nullable String qualifier) {
ComponentDto provisionedComponent = componentService.create(dbSession, NewComponent.create(key, name).setQualifier(qualifier).setBranch(branch));
- permissionService.applyDefaultPermissionTemplate(dbSession, provisionedComponent.getKey());
+ permissionTemplateService.applyDefaultPermissionTemplate(dbSession, provisionedComponent.getKey());
return provisionedComponent.getId();
}
import org.sonar.db.component.ComponentDto;
import org.sonar.server.component.ComponentService;
import org.sonar.server.component.NewComponent;
-import org.sonar.server.permission.PermissionService;
+import org.sonar.server.permission.PermissionTemplateService;
import org.sonar.server.user.UserSession;
import static org.sonar.core.permission.GlobalPermissions.SCAN_EXECUTION;
private final CeQueue queue;
private final UserSession userSession;
private final ComponentService componentService;
- private final PermissionService permissionTemplateService;
+ private final PermissionTemplateService permissionTemplateService;
private final DbClient dbClient;
public ReportSubmitter(CeQueue queue, UserSession userSession,
- ComponentService componentService, PermissionService permissionTemplateService, DbClient dbClient) {
+ ComponentService componentService, PermissionTemplateService permissionTemplateService, DbClient dbClient) {
this.queue = queue;
this.userSession = userSession;
this.componentService = componentService;
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.permission;
-
-import java.util.Collection;
-import java.util.List;
-import javax.annotation.Nullable;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.server.ServerSide;
-import org.sonar.core.component.ComponentKeys;
-import org.sonar.core.permission.GlobalPermissions;
-import org.sonar.core.util.stream.Collectors;
-import org.sonar.db.DbClient;
-import org.sonar.db.DbSession;
-import org.sonar.db.component.ComponentDto;
-import org.sonar.db.component.ResourceDto;
-import org.sonar.db.permission.PermissionRepository;
-import org.sonar.db.permission.template.PermissionTemplateDto;
-import org.sonar.server.permission.index.PermissionIndexer;
-import org.sonar.server.user.UserSession;
-
-import static java.util.Arrays.asList;
-import static org.sonar.server.permission.PermissionPrivilegeChecker.checkProjectAdminUserByComponentKey;
-import static org.sonar.server.ws.WsUtils.checkFoundWithOptional;
-
-@ServerSide
-public class PermissionService {
-
- private final DbClient dbClient;
- private final PermissionRepository permissionRepository;
- private final PermissionIndexer permissionIndexer;
- private final UserSession userSession;
-
- public PermissionService(DbClient dbClient, PermissionRepository permissionRepository, PermissionIndexer permissionIndexer, UserSession userSession) {
- this.dbClient = dbClient;
- this.permissionRepository = permissionRepository;
- this.permissionIndexer = permissionIndexer;
- this.userSession = userSession;
- }
-
- public void applyDefaultPermissionTemplate(String componentKey) {
- DbSession session = dbClient.openSession(false);
- try {
- applyDefaultPermissionTemplate(session, componentKey);
- } finally {
- session.close();
- }
- }
-
- /**
- * @deprecated replaced by {@link #applyDefault(DbSession, ComponentDto, Long)}, which <b>does not
- * verify that user is authorized to administrate the component</b>.
- */
- @Deprecated
- public void applyDefaultPermissionTemplate(DbSession session, String componentKey) {
- ComponentDto component = checkFoundWithOptional(dbClient.componentDao().selectByKey(session, componentKey), "Component key '%s' not found", componentKey);
- ResourceDto provisioned = dbClient.resourceDao().selectProvisionedProject(session, componentKey);
- if (provisioned == null) {
- checkProjectAdminUserByComponentKey(userSession, componentKey);
- } else {
- userSession.checkPermission(GlobalPermissions.PROVISIONING);
- }
-
- Integer currentUserId = userSession.getUserId();
- Long userId = Qualifiers.PROJECT.equals(component.qualifier()) && currentUserId != null ? currentUserId.longValue() : null;
- permissionRepository.applyDefaultPermissionTemplate(session, component, userId);
- session.commit();
- indexProjectPermissions(session, asList(component.uuid()));
- }
-
- public boolean wouldCurrentUserHavePermissionWithDefaultTemplate(DbSession dbSession, String permission, @Nullable String branch, String projectKey, String qualifier) {
- if (userSession.hasPermission(permission)) {
- return true;
- }
-
- String effectiveKey = ComponentKeys.createKey(projectKey, branch);
-
- Long userId = userSession.getUserId() == null ? null : userSession.getUserId().longValue();
- return permissionRepository.wouldUserHavePermissionWithDefaultTemplate(dbSession, userId, permission, effectiveKey, qualifier);
- }
-
- public void apply(DbSession dbSession, PermissionTemplateDto template, Collection<ComponentDto> projects) {
- if (projects.isEmpty()) {
- return;
- }
-
- for (ComponentDto project : projects) {
- permissionRepository.apply(dbSession, template, project, null);
- }
- dbSession.commit();
- indexProjectPermissions(dbSession, projects.stream().map(ComponentDto::uuid).collect(Collectors.toList()));
- }
-
- /**
- * Apply the default permission template to component, whatever it already exists (and has permissions) or if it's
- * provisioned (and has no permissions yet).
- *
- * @param dbSession
- * @param component
- * @param projectCreatorUserId id of the user who creates the project, only if project is provisioned. He will
- * benefit from the permissions defined in the template for "project creator".
- */
- public void applyDefault(DbSession dbSession, ComponentDto component, @Nullable Long projectCreatorUserId) {
- permissionRepository.applyDefaultPermissionTemplate(dbSession, component, projectCreatorUserId);
- dbSession.commit();
- indexProjectPermissions(dbSession, asList(component.uuid()));
- }
-
- private void indexProjectPermissions(DbSession dbSession, List<String> projectUuids) {
- permissionIndexer.index(dbSession, projectUuids);
- }
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.server.permission;
+
+import java.util.Collection;
+import java.util.List;
+import javax.annotation.Nullable;
+import org.sonar.api.resources.Qualifiers;
+import org.sonar.api.server.ServerSide;
+import org.sonar.core.component.ComponentKeys;
+import org.sonar.core.permission.GlobalPermissions;
+import org.sonar.core.util.stream.Collectors;
+import org.sonar.db.DbClient;
+import org.sonar.db.DbSession;
+import org.sonar.db.component.ComponentDto;
+import org.sonar.db.component.ResourceDto;
+import org.sonar.db.permission.PermissionRepository;
+import org.sonar.db.permission.template.PermissionTemplateDto;
+import org.sonar.server.permission.index.PermissionIndexer;
+import org.sonar.server.user.UserSession;
+
+import static java.util.Arrays.asList;
+import static org.sonar.server.permission.PermissionPrivilegeChecker.checkProjectAdminUserByComponentKey;
+import static org.sonar.server.ws.WsUtils.checkFoundWithOptional;
+
+@ServerSide
+public class PermissionTemplateService {
+
+ private final DbClient dbClient;
+ private final PermissionRepository permissionRepository;
+ private final PermissionIndexer permissionIndexer;
+ private final UserSession userSession;
+
+ public PermissionTemplateService(DbClient dbClient, PermissionRepository permissionRepository, PermissionIndexer permissionIndexer, UserSession userSession) {
+ this.dbClient = dbClient;
+ this.permissionRepository = permissionRepository;
+ this.permissionIndexer = permissionIndexer;
+ this.userSession = userSession;
+ }
+
+ /**
+ * @deprecated replaced by {@link #applyDefault(DbSession, ComponentDto, Long)}, which <b>does not
+ * verify that user is authorized to administrate the component</b>.
+ */
+ @Deprecated
+ public void applyDefaultPermissionTemplate(String componentKey) {
+ DbSession session = dbClient.openSession(false);
+ try {
+ applyDefaultPermissionTemplate(session, componentKey);
+ } finally {
+ session.close();
+ }
+ }
+
+ /**
+ * @deprecated replaced by {@link #applyDefault(DbSession, ComponentDto, Long)}, which <b>does not
+ * verify that user is authorized to administrate the component</b>.
+ */
+ @Deprecated
+ public void applyDefaultPermissionTemplate(DbSession session, String componentKey) {
+ ComponentDto component = checkFoundWithOptional(dbClient.componentDao().selectByKey(session, componentKey), "Component key '%s' not found", componentKey);
+ ResourceDto provisioned = dbClient.resourceDao().selectProvisionedProject(session, componentKey);
+ if (provisioned == null) {
+ checkProjectAdminUserByComponentKey(userSession, componentKey);
+ } else {
+ userSession.checkPermission(GlobalPermissions.PROVISIONING);
+ }
+
+ Integer currentUserId = userSession.getUserId();
+ Long userId = Qualifiers.PROJECT.equals(component.qualifier()) && currentUserId != null ? currentUserId.longValue() : null;
+ permissionRepository.applyDefaultPermissionTemplate(session, component, userId);
+ session.commit();
+ indexProjectPermissions(session, asList(component.uuid()));
+ }
+
+ public boolean wouldCurrentUserHavePermissionWithDefaultTemplate(DbSession dbSession, String permission, @Nullable String branch, String projectKey, String qualifier) {
+ if (userSession.hasPermission(permission)) {
+ return true;
+ }
+
+ String effectiveKey = ComponentKeys.createKey(projectKey, branch);
+
+ Long userId = userSession.getUserId() == null ? null : userSession.getUserId().longValue();
+ return permissionRepository.wouldUserHavePermissionWithDefaultTemplate(dbSession, userId, permission, effectiveKey, qualifier);
+ }
+
+ /**
+ * Apply a permission template to a set of projects. Authorization to administrate these projects
+ * is not verified. The projects must exist, so the "project creator" permissions defined in the
+ * template are ignored.
+ */
+ public void apply(DbSession dbSession, PermissionTemplateDto template, Collection<ComponentDto> projects) {
+ if (projects.isEmpty()) {
+ return;
+ }
+
+ for (ComponentDto project : projects) {
+ permissionRepository.apply(dbSession, template, project, null);
+ }
+ dbSession.commit();
+ indexProjectPermissions(dbSession, projects.stream().map(ComponentDto::uuid).collect(Collectors.toList()));
+ }
+
+ /**
+ * Apply the default permission template to project. The project can already exist (so it has permissions) or
+ * can be provisioned (so has no permissions yet).
+ *
+ * @param dbSession
+ * @param component
+ * @param projectCreatorUserId id of the user who creates the project, only if project is provisioned. He will
+ * benefit from the permissions defined in the template for "project creator".
+ */
+ public void applyDefault(DbSession dbSession, ComponentDto component, @Nullable Long projectCreatorUserId) {
+ permissionRepository.applyDefaultPermissionTemplate(dbSession, component, projectCreatorUserId);
+ dbSession.commit();
+ indexProjectPermissions(dbSession, asList(component.uuid()));
+ }
+
+ private void indexProjectPermissions(DbSession dbSession, List<String> projectUuids) {
+ permissionIndexer.index(dbSession, projectUuids);
+ }
+}
import org.sonar.db.DbSession;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.permission.template.PermissionTemplateDto;
-import org.sonar.server.permission.PermissionService;
+import org.sonar.server.permission.PermissionTemplateService;
import org.sonar.server.permission.ProjectId;
import org.sonar.server.permission.ws.PermissionWsSupport;
import org.sonar.server.permission.ws.PermissionsWsAction;
public class ApplyTemplateAction implements PermissionsWsAction {
private final DbClient dbClient;
private final UserSession userSession;
- private final PermissionService permissionService;
+ private final PermissionTemplateService permissionTemplateService;
private final PermissionWsSupport wsSupport;
- public ApplyTemplateAction(DbClient dbClient, UserSession userSession, PermissionService permissionService,
+ public ApplyTemplateAction(DbClient dbClient, UserSession userSession, PermissionTemplateService permissionTemplateService,
PermissionWsSupport wsSupport) {
this.dbClient = dbClient;
this.userSession = userSession;
- this.permissionService = permissionService;
+ this.permissionTemplateService = permissionTemplateService;
this.wsSupport = wsSupport;
}
ProjectId projectId = new ProjectId(project);
checkProjectAdmin(userSession, template.getOrganizationUuid(), Optional.of(projectId));
- permissionService.apply(dbSession, template, Collections.singletonList(project));
+ permissionTemplateService.apply(dbSession, template, Collections.singletonList(project));
}
}
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ComponentQuery;
import org.sonar.db.permission.template.PermissionTemplateDto;
-import org.sonar.server.permission.PermissionService;
+import org.sonar.server.permission.PermissionTemplateService;
import org.sonar.server.permission.ProjectId;
import org.sonar.server.permission.ws.PermissionWsSupport;
import org.sonar.server.permission.ws.PermissionsWsAction;
private final DbClient dbClient;
private final UserSession userSession;
- private final PermissionService permissionService;
+ private final PermissionTemplateService permissionTemplateService;
private final PermissionWsSupport wsSupport;
private final I18n i18n;
private final ResourceTypes resourceTypes;
- public BulkApplyTemplateAction(DbClient dbClient, UserSession userSession, PermissionService permissionService, PermissionWsSupport wsSupport, I18n i18n,
+ public BulkApplyTemplateAction(DbClient dbClient, UserSession userSession, PermissionTemplateService permissionTemplateService, PermissionWsSupport wsSupport, I18n i18n,
ResourceTypes resourceTypes) {
this.dbClient = dbClient;
this.userSession = userSession;
- this.permissionService = permissionService;
+ this.permissionTemplateService = permissionTemplateService;
this.wsSupport = wsSupport;
this.i18n = i18n;
this.resourceTypes = resourceTypes;
ProjectId projectId = new ProjectId(project);
checkProjectAdmin(userSession, template.getOrganizationUuid(), Optional.of(projectId));
}
- permissionService.apply(dbSession, template, projects);
+ permissionTemplateService.apply(dbSession, template, projects);
}
}
import org.sonar.server.notification.email.EmailNotificationChannel;
import org.sonar.server.organization.ws.OrganizationsWsModule;
import org.sonar.server.permission.GroupPermissionChanger;
-import org.sonar.server.permission.PermissionService;
+import org.sonar.server.permission.PermissionTemplateService;
import org.sonar.server.permission.PermissionUpdater;
import org.sonar.server.permission.UserPermissionChanger;
import org.sonar.server.permission.index.PermissionIndexer;
// permissions
PermissionsWsModule.class,
PermissionRepository.class,
- PermissionService.class,
+ PermissionTemplateService.class,
PermissionUpdater.class,
UserPermissionChanger.class,
GroupPermissionChanger.class,
import org.sonar.server.es.EsTester;
import org.sonar.server.exceptions.BadRequestException;
import org.sonar.server.i18n.I18nRule;
-import org.sonar.server.permission.PermissionService;
+import org.sonar.server.permission.PermissionTemplateService;
import org.sonar.server.tester.UserSessionRule;
import static com.google.common.collect.Lists.newArrayList;
ResourceDao resourceDao = dbClient.resourceDao();
ComponentService componentService = new ComponentService(dbClient, i18n, userSession, System2.INSTANCE, new ComponentFinder(dbClient),
new ProjectMeasuresIndexer(dbClient, es.client()));
- PermissionService permissionService = mock(PermissionService.class);
+ PermissionTemplateService permissionTemplateService = mock(PermissionTemplateService.class);
ComponentDbTester componentDb = new ComponentDbTester(db);
- DefaultRubyComponentService service = new DefaultRubyComponentService(dbClient, resourceDao, componentService, permissionService);
+ DefaultRubyComponentService service = new DefaultRubyComponentService(dbClient, resourceDao, componentService, permissionTemplateService);
@Test
public void find_by_key() {
assertThat(project.name()).isEqualTo(componentName);
assertThat(project.qualifier()).isEqualTo(qualifier);
assertThat(project.getId()).isEqualTo(result);
- verify(permissionService).applyDefaultPermissionTemplate(any(DbSession.class), eq(componentKey));
+ verify(permissionTemplateService).applyDefaultPermissionTemplate(any(DbSession.class), eq(componentKey));
}
@Test(expected = BadRequestException.class)
import org.sonar.server.component.ComponentService;
import org.sonar.server.component.NewComponent;
import org.sonar.server.exceptions.ForbiddenException;
-import org.sonar.server.permission.PermissionService;
+import org.sonar.server.permission.PermissionTemplateService;
import org.sonar.server.tester.UserSessionRule;
import static org.assertj.core.api.Assertions.assertThat;
private CeQueue queue = mock(CeQueueImpl.class);
private ComponentService componentService = mock(ComponentService.class);
- private PermissionService permissionService = mock(PermissionService.class);
- private ReportSubmitter underTest = new ReportSubmitter(queue, userSession, componentService, permissionService, db.getDbClient());
+ private PermissionTemplateService permissionTemplateService = mock(PermissionTemplateService.class);
+ private ReportSubmitter underTest = new ReportSubmitter(queue, userSession, componentService, permissionTemplateService, db.getDbClient());
@Test
public void submit_a_report_on_existing_project() {
underTest.submit(project.getKey(), null, project.name(), IOUtils.toInputStream("{binary}"));
verifyReportIsPersisted(TASK_UUID);
- verifyZeroInteractions(permissionService);
+ verifyZeroInteractions(permissionTemplateService);
verify(queue).submit(argThat(new TypeSafeMatcher<CeTaskSubmit>() {
@Override
protected boolean matchesSafely(CeTaskSubmit submit) {
when(queue.prepareSubmit()).thenReturn(new CeTaskSubmit.Builder(TASK_UUID));
ComponentDto createdProject = new ComponentDto().setUuid(PROJECT_UUID).setKey(PROJECT_KEY);
when(componentService.create(any(DbSession.class), any(NewComponent.class))).thenReturn(createdProject);
- when(permissionService.wouldCurrentUserHavePermissionWithDefaultTemplate(any(DbSession.class), eq(SCAN_EXECUTION), anyString(), eq(PROJECT_KEY), eq(Qualifiers.PROJECT)))
+ when(permissionTemplateService.wouldCurrentUserHavePermissionWithDefaultTemplate(any(DbSession.class), eq(SCAN_EXECUTION), anyString(), eq(PROJECT_KEY), eq(Qualifiers.PROJECT)))
.thenReturn(true);
underTest.submit(PROJECT_KEY, null, PROJECT_NAME, IOUtils.toInputStream("{binary}"));
verifyReportIsPersisted(TASK_UUID);
- verify(permissionService).applyDefault(any(DbSession.class), eq(createdProject), anyLong());
+ verify(permissionTemplateService).applyDefault(any(DbSession.class), eq(createdProject), anyLong());
verify(queue).submit(argThat(new TypeSafeMatcher<CeTaskSubmit>() {
@Override
protected boolean matchesSafely(CeTaskSubmit submit) {
when(queue.prepareSubmit()).thenReturn(new CeTaskSubmit.Builder(TASK_UUID));
when(componentService.create(any(DbSession.class), any(NewComponent.class))).thenReturn(new ComponentDto().setUuid(PROJECT_UUID).setKey(PROJECT_KEY));
- when(permissionService.wouldCurrentUserHavePermissionWithDefaultTemplate(any(DbSession.class), eq(SCAN_EXECUTION), anyString(), eq(PROJECT_KEY), eq(Qualifiers.PROJECT)))
+ when(permissionTemplateService.wouldCurrentUserHavePermissionWithDefaultTemplate(any(DbSession.class), eq(SCAN_EXECUTION), anyString(), eq(PROJECT_KEY), eq(Qualifiers.PROJECT)))
.thenReturn(true);
underTest.submit(PROJECT_KEY, null, PROJECT_NAME, IOUtils.toInputStream("{binary}"));
import org.sonar.db.permission.template.PermissionTemplateDto;
import org.sonar.db.user.GroupDto;
import org.sonar.db.user.UserDto;
-import org.sonar.server.component.ComponentFinder;
import org.sonar.server.component.es.ProjectMeasuresIndexDefinition;
import org.sonar.server.es.EsTester;
import org.sonar.server.exceptions.BadRequestException;
import org.sonar.server.exceptions.ForbiddenException;
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.issue.index.IssueIndexDefinition;
-import org.sonar.server.permission.PermissionService;
+import org.sonar.server.permission.PermissionTemplateService;
import org.sonar.server.permission.index.PermissionIndexer;
import org.sonar.server.permission.index.PermissionIndexerTester;
import org.sonar.server.permission.ws.BasePermissionWsTest;
@Override
protected ApplyTemplateAction buildWsAction() {
PermissionRepository repository = new PermissionRepository(db.getDbClient(), new MapSettings());
- PermissionService permissionService = new PermissionService(db.getDbClient(), repository, permissionIndexer, userSession);
- return new ApplyTemplateAction(db.getDbClient(), userSession, permissionService, newPermissionWsSupport());
+ PermissionTemplateService permissionTemplateService = new PermissionTemplateService(db.getDbClient(), repository, permissionIndexer, userSession);
+ return new ApplyTemplateAction(db.getDbClient(), userSession, permissionTemplateService, newPermissionWsSupport());
}
@Before
import org.sonar.server.exceptions.BadRequestException;
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.i18n.I18nRule;
-import org.sonar.server.permission.PermissionService;
+import org.sonar.server.permission.PermissionTemplateService;
import org.sonar.server.permission.index.PermissionIndexer;
import org.sonar.server.permission.ws.BasePermissionWsTest;
@Override
protected BulkApplyTemplateAction buildWsAction() {
PermissionRepository repository = new PermissionRepository(db.getDbClient(), new MapSettings());
- PermissionService permissionService = new PermissionService(db.getDbClient(), repository, issuePermissionIndexer, userSession);
- return new BulkApplyTemplateAction(db.getDbClient(), userSession, permissionService, newPermissionWsSupport(), new I18nRule(), newRootResourceTypes());
+ PermissionTemplateService permissionTemplateService = new PermissionTemplateService(db.getDbClient(), repository, issuePermissionIndexer, userSession);
+ return new BulkApplyTemplateAction(db.getDbClient(), userSession, permissionTemplateService, newPermissionWsSupport(), new I18nRule(), newRootResourceTypes());
}
@Before