aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-08-24 14:38:21 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-08-24 14:38:21 +0200
commitbd80840c368d1f0886c8bfaf7913d09e1fbc4ec3 (patch)
treea96172dc11f206f7a6c4e7956f72750e55f374ee /sonar-db
parent2bfefbed900d10ee2320630c83f13d21346a1bb8 (diff)
downloadsonarqube-bd80840c368d1f0886c8bfaf7913d09e1fbc4ec3.tar.gz
sonarqube-bd80840c368d1f0886c8bfaf7913d09e1fbc4ec3.zip
SONAR-6479 WS permissions/users display email in response
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/main/java/org/sonar/core/permission/UserWithPermission.java10
-rw-r--r--sonar-db/src/main/java/org/sonar/db/permission/UserWithPermissionDto.java11
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/permission/PermissionMapper.xml2
-rw-r--r--sonar-db/src/test/java/org/sonar/db/user/UserTesting.java2
4 files changed, 24 insertions, 1 deletions
diff --git a/sonar-db/src/main/java/org/sonar/core/permission/UserWithPermission.java b/sonar-db/src/main/java/org/sonar/core/permission/UserWithPermission.java
index 69a2f77a28a..7e8080d4ccb 100644
--- a/sonar-db/src/main/java/org/sonar/core/permission/UserWithPermission.java
+++ b/sonar-db/src/main/java/org/sonar/core/permission/UserWithPermission.java
@@ -26,6 +26,7 @@ public class UserWithPermission {
private String login;
private String name;
+ private String email;
private boolean hasPermission;
public String login() {
@@ -46,6 +47,15 @@ public class UserWithPermission {
return this;
}
+ public String email() {
+ return email;
+ }
+
+ public UserWithPermission setEmail(String email) {
+ this.email = email;
+ return this;
+ }
+
public boolean hasPermission() {
return hasPermission;
}
diff --git a/sonar-db/src/main/java/org/sonar/db/permission/UserWithPermissionDto.java b/sonar-db/src/main/java/org/sonar/db/permission/UserWithPermissionDto.java
index 66c7d176c96..efa0d17c07c 100644
--- a/sonar-db/src/main/java/org/sonar/db/permission/UserWithPermissionDto.java
+++ b/sonar-db/src/main/java/org/sonar/db/permission/UserWithPermissionDto.java
@@ -28,6 +28,7 @@ public class UserWithPermissionDto {
private String login;
private String name;
+ private String email;
private String permission;
public String getLogin() {
@@ -48,6 +49,15 @@ public class UserWithPermissionDto {
return this;
}
+ public String getEmail() {
+ return email;
+ }
+
+ public UserWithPermissionDto setEmail(String email) {
+ this.email = email;
+ return this;
+ }
+
@CheckForNull
public String getPermission() {
return permission;
@@ -62,6 +72,7 @@ public class UserWithPermissionDto {
return new UserWithPermission()
.setLogin(login)
.setName(name)
+ .setEmail(email)
.hasPermission(permission != null);
}
}
diff --git a/sonar-db/src/main/resources/org/sonar/db/permission/PermissionMapper.xml b/sonar-db/src/main/resources/org/sonar/db/permission/PermissionMapper.xml
index 49c48507b39..df882e98a97 100644
--- a/sonar-db/src/main/resources/org/sonar/db/permission/PermissionMapper.xml
+++ b/sonar-db/src/main/resources/org/sonar/db/permission/PermissionMapper.xml
@@ -4,7 +4,7 @@
<mapper namespace="org.sonar.db.permission.PermissionMapper">
<select id="selectUsers" parameterType="map" resultType="UserWithPermission">
- SELECT u.login as login, u.name as name, user_role.role as permission
+ SELECT u.login as login, u.name as name, u.email as email, user_role.role as permission
<include refid="usersSelection"/>
ORDER BY u.name
</select>
diff --git a/sonar-db/src/test/java/org/sonar/db/user/UserTesting.java b/sonar-db/src/test/java/org/sonar/db/user/UserTesting.java
index 2592ef1e2fb..04bb4ab02bb 100644
--- a/sonar-db/src/test/java/org/sonar/db/user/UserTesting.java
+++ b/sonar-db/src/test/java/org/sonar/db/user/UserTesting.java
@@ -20,6 +20,7 @@
package org.sonar.db.user;
+import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
import static org.apache.commons.lang.math.RandomUtils.nextBoolean;
import static org.apache.commons.lang.math.RandomUtils.nextLong;
@@ -30,6 +31,7 @@ public class UserTesting {
UserDto user = new UserDto()
.setActive(nextBoolean())
.setName(randomAlphanumeric(30))
+ .setEmail(randomAlphabetic(30))
.setLogin(randomAlphanumeric(30));
user.setCreatedAt(nextLong())
.setUpdatedAt(nextLong());