aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-10-17 12:28:47 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-10-19 14:45:13 +0200
commit0043949d55cbb4da6ac6e52b62d863560b04f970 (patch)
treef6d2aa8f862de22d56edf9eae835deca3acf8466 /sonar-db
parentc1e059083d7a2f294caf8721257e81e24480c083 (diff)
downloadsonarqube-0043949d55cbb4da6ac6e52b62d863560b04f970.tar.gz
sonarqube-0043949d55cbb4da6ac6e52b62d863560b04f970.zip
SONAR-8192 set root flag in UserIdentityAuthenticator
depending upon whether groups of the user have or not System Administer permision and whether, when it already exists, the user has user permission "System Administer"
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/test/java/org/sonar/db/user/RootFlagAssertions.java8
-rw-r--r--sonar-db/src/test/java/org/sonar/db/user/UserDbTester.java10
2 files changed, 17 insertions, 1 deletions
diff --git a/sonar-db/src/test/java/org/sonar/db/user/RootFlagAssertions.java b/sonar-db/src/test/java/org/sonar/db/user/RootFlagAssertions.java
index 344d5dcb7ce..af7abd8f7c7 100644
--- a/sonar-db/src/test/java/org/sonar/db/user/RootFlagAssertions.java
+++ b/sonar-db/src/test/java/org/sonar/db/user/RootFlagAssertions.java
@@ -51,6 +51,12 @@ public class RootFlagAssertions {
.isEqualTo(root);
assertThat(dto.getUpdatedAt())
.as("UpdatedAt of user '%s' has changed since insertion", userDto.getLogin())
- .isNotEqualTo(userDto);
+ .isNotEqualTo(userDto.getUpdatedAt());
+ }
+
+ public void verify(String login, boolean root) {
+ assertThat(db.getDbClient().userDao().selectByLogin(db.getSession(), login).isRoot())
+ .as("Root flag of user '%s' is '%s'", login, root)
+ .isEqualTo(root);
}
}
diff --git a/sonar-db/src/test/java/org/sonar/db/user/UserDbTester.java b/sonar-db/src/test/java/org/sonar/db/user/UserDbTester.java
index 31ef077d935..3f8e9f63dfb 100644
--- a/sonar-db/src/test/java/org/sonar/db/user/UserDbTester.java
+++ b/sonar-db/src/test/java/org/sonar/db/user/UserDbTester.java
@@ -173,6 +173,16 @@ public class UserDbTester {
}
/**
+ * Creates a group with the specified name in the specified organization with {@link GlobalPermissions#SYSTEM_ADMIN}
+ * permission.
+ */
+ public GroupDto insertAdminGroup(OrganizationDto organizationDto, String name) {
+ GroupDto groupDto = insertGroup(organizationDto, name);
+ insertPermissionOnGroup(groupDto, SYSTEM_ADMIN);
+ return groupDto;
+ }
+
+ /**
* Create group in specified organization
*/
public GroupDto insertGroup(OrganizationDto organizationDto) {