format.json {
render :json => {
:more => more,
- :results => groups.map { |group| {
- :name => group.name(),
- :selected => group.hasPermission()
- }}
+ :results => groups.map { |group|
+ hash = {
+ :name => group.name(),
+ :selected => group.hasPermission()
+ }
+ hash[:description] = group.description() if group.description() && !group.description().blank?
+ hash
+ }
}
}
end
</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}
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();
}
<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"/>