aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-08-26 15:28:51 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-08-26 15:50:39 +0200
commit680f1e0dd4d2b72e7eac70920ba153a60c9cb006 (patch)
tree1633b5578de4a98082043697ffe4e98b56669250 /sonar-core
parent20ae7f5d735a0139de612fb46a9e5478e8d264c2 (diff)
downloadsonarqube-680f1e0dd4d2b72e7eac70920ba153a60c9cb006.tar.gz
sonarqube-680f1e0dd4d2b72e7eac70920ba153a60c9cb006.zip
SONAR-4963 Return description in /permission_templates/search_groups
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml6
-rw-r--r--sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java4
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest/groups_with_permissions.xml6
3 files changed, 10 insertions, 6 deletions
diff --git a/sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml b/sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml
index 2ec027daa89..64fb208e8e9 100644
--- a/sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml
@@ -89,15 +89,15 @@
</select>
<select id="selectGroups" parameterType="map" resultType="GroupWithPermission">
- SELECT name, permission FROM
- (SELECT g.name as name, ptg.permission_reference as permission
+ SELECT name, description, permission FROM
+ (SELECT g.name as name, g.description as description, ptg.permission_reference as permission
FROM groups g
LEFT JOIN perm_templates_groups ptg ON ptg.group_id=g.id
AND ptg.permission_reference=#{query.permission}
AND ptg.template_id=#{templateId}
UNION
-- Add Anyone group permission
- SELECT #{anyoneGroup} as name, ptg.permission_reference as permission
+ SELECT #{anyoneGroup} as name, NULL as description, ptg.permission_reference as permission
FROM perm_templates_groups ptg
<where>
AND ptg.permission_reference=#{query.permission}
diff --git a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java
index f91e616233a..8f3ee7d8ae2 100644
--- a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java
@@ -51,18 +51,22 @@ public class GroupWithPermissionTemplateDaoTest extends AbstractDaoTestCase {
GroupWithPermissionDto anyone = result.get(0);
assertThat(anyone.getName()).isEqualTo("Anyone");
+ assertThat(anyone.getDescription()).isNull();
assertThat(anyone.getPermission()).isNotNull();
GroupWithPermissionDto group1 = result.get(1);
assertThat(group1.getName()).isEqualTo("sonar-administrators");
+ assertThat(group1.getDescription()).isEqualTo("System administrators");
assertThat(group1.getPermission()).isNotNull();
GroupWithPermissionDto group2 = result.get(2);
assertThat(group2.getName()).isEqualTo("sonar-reviewers");
+ assertThat(group2.getDescription()).isEqualTo("Reviewers");
assertThat(group2.getPermission()).isNull();
GroupWithPermissionDto group3 = result.get(3);
assertThat(group3.getName()).isEqualTo("sonar-users");
+ assertThat(group3.getDescription()).isEqualTo("Any new users created will automatically join this group");
assertThat(group3.getPermission()).isNotNull();
}
diff --git a/sonar-core/src/test/resources/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest/groups_with_permissions.xml b/sonar-core/src/test/resources/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest/groups_with_permissions.xml
index 38240ab4255..8d6592cbc11 100644
--- a/sonar-core/src/test/resources/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest/groups_with_permissions.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest/groups_with_permissions.xml
@@ -1,8 +1,8 @@
<dataset>
- <groups id="200" name="sonar-administrators"/>
- <groups id="201" name="sonar-users" />
- <groups id="202" name="sonar-reviewers" />
+ <groups id="200" name="sonar-administrators" description="System administrators"/>
+ <groups id="201" name="sonar-users" description="Any new users created will automatically join this group"/>
+ <groups id="202" name="sonar-reviewers" description="Reviewers"/>
<perm_templates_groups id="1" group_id="200" permission_reference="user" template_id="50"/>
<perm_templates_groups id="2" group_id="200" permission_reference="admin" template_id="50"/>