diff options
author | Sulabh Upadhyay <suupadhy@microsoft.com> | 2015-09-24 17:53:26 +0530 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-10-05 21:50:37 +0200 |
commit | dc5cb124d46e90c3823f47573ca25c808507d14c (patch) | |
tree | 1cd13f49e3692ed264d63c20e459fb8993bdadef /sonar-plugin-api/src/main | |
parent | 0ce77c4e398676668288ad4e065a1ff7a1e24cf1 (diff) | |
download | sonarqube-dc5cb124d46e90c3823f47573ca25c808507d14c.tar.gz sonarqube-dc5cb124d46e90c3823f47573ca25c808507d14c.zip |
SONAR-6867: Add a new APIs UserDetails.getUserId()/setUserId(String userId)
to allow plugins to pass userId information to SonarQube
setUserId(String userId) and getUserId () are added to UserDetails.
Testing
1. Unit test for UserDetails
2. Verification of following scenarios :
a. Plugin (e.g. LDAP) is dependent on older sonarqube plugins apis
( < 5.2) and the plugin is being used in SonarQube 5.2 server
b. Plugin is dependent on SonarQube 5.2 plugin apis and userId is not
being populated in UserDetails along with userName and Email .
c. Plugin is dependent on SonarQube 5.2 plugin apis and userId is
also being populated by the plugin in UserDetails along with
userName and Email.
Diffstat (limited to 'sonar-plugin-api/src/main')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/security/UserDetails.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/UserDetails.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/UserDetails.java index 115915e8047..705d2bcf649 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/security/UserDetails.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/security/UserDetails.java @@ -24,13 +24,14 @@ import com.google.common.base.Objects; /** * This class is not intended to be subclassed by clients. * - * @since 2.14 * @see ExternalUsersProvider + * @since 2.14 */ public final class UserDetails { private String name = ""; private String email = ""; + private String userId = ""; public UserDetails() { } @@ -51,11 +52,26 @@ public final class UserDetails { return name; } + /** + * @since 5.2 + */ + public void setUserId(String userId) { + this.userId = userId; + } + + /** + * @since 5.2 + */ + public String getUserId() { + return userId; + } + @Override public String toString() { return Objects.toStringHelper(this) - .add("name", name) - .add("email", email) - .toString(); + .add("name", name) + .add("email", email) + .add("userId", userId) + .toString(); } } |