aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-07-23 14:44:43 +0200
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-07-23 14:44:43 +0200
commitceeccdc1109973d6572feb07f3c161bb723bea77 (patch)
tree674d7e9db7b95085e080fafb7bf82fbdbf0c46e3 /sonar-core/src
parent6ce684efe53af47ea86ce786114bc8b083472409 (diff)
downloadsonarqube-ceeccdc1109973d6572feb07f3c161bb723bea77.tar.gz
sonarqube-ceeccdc1109973d6572feb07f3c161bb723bea77.zip
SONAR-4451 Permission templates will be applied to all the projects matching the search criteria
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java10
-rw-r--r--sonar-core/src/main/java/org/sonar/core/permission/ComponentPermissionFacade.java1
-rw-r--r--sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java1
-rw-r--r--sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java2
4 files changed, 13 insertions, 1 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java b/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java
index a886424f247..1043ad3ca61 100644
--- a/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java
+++ b/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java
@@ -23,11 +23,21 @@ import org.sonar.api.component.Component;
public class ComponentDto implements Component {
+ private Long id;
private String key;
private String name;
private String longName;
private String qualifier;
+ public Long getId() {
+ return id;
+ }
+
+ public ComponentDto setId(Long id) {
+ this.id = id;
+ return this;
+ }
+
@Override
public String key() {
return key;
diff --git a/sonar-core/src/main/java/org/sonar/core/permission/ComponentPermissionFacade.java b/sonar-core/src/main/java/org/sonar/core/permission/ComponentPermissionFacade.java
index b455aa61679..f681635865a 100644
--- a/sonar-core/src/main/java/org/sonar/core/permission/ComponentPermissionFacade.java
+++ b/sonar-core/src/main/java/org/sonar/core/permission/ComponentPermissionFacade.java
@@ -141,7 +141,6 @@ public class ComponentPermissionFacade implements TaskComponent, ServerComponent
if(usersPermissions != null) {
for (PermissionTemplateUserDto userPermission : usersPermissions) {
addUserPermission(resourceId, userPermission.getUserLogin(), userPermission.getPermission(), session);
-
}
}
List<PermissionTemplateGroupDto> groupsPermissions = permissionTemplate.getGroupsPermissions();
diff --git a/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java b/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java
index 18bb0ec788c..6d68359fe07 100644
--- a/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java
@@ -220,6 +220,7 @@ public class ResourceDao {
public static ComponentDto toComponent(ResourceDto resourceDto){
return new ComponentDto()
+ .setId(resourceDto.getId())
.setKey(resourceDto.getKey())
.setLongName(resourceDto.getLongName())
.setName(resourceDto.getName())
diff --git a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java
index 11a7edcd71e..2b38ad2e31f 100644
--- a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java
@@ -25,6 +25,7 @@ import org.junit.Test;
import org.sonar.api.component.Component;
import org.sonar.api.resources.Qualifiers;
import org.sonar.api.resources.Scopes;
+import org.sonar.core.component.ComponentDto;
import org.sonar.core.persistence.AbstractDaoTestCase;
import java.util.Collection;
@@ -316,6 +317,7 @@ public class ResourceDaoTest extends AbstractDaoTestCase {
List<Component> components = dao.selectComponentsByQualifiers(newArrayList("TRK"));
assertThat(components).hasSize(1);
assertThat(components.get(0).key()).isEqualTo("org.struts:struts");
+ assertThat(((ComponentDto)components.get(0)).getId()).isEqualTo(1L);
assertThat(dao.selectComponentsByQualifiers(newArrayList("unknown"))).isEmpty();
assertThat(dao.selectComponentsByQualifiers(Collections.<String>emptyList())).isEmpty();