Create a new user in the sonar

Is it possible to create a new user in sonar without using the web interface? I need to write a script that inserts the same users for some tools, including sonar.

+6
sonarqube
source share
3 answers

There are three ways to do this:

  • Writing directly to the database (there is a simple table called users).

  • Use the LDAP plugin, if you specify sonar.authenticator.createUsers: true in sonar.properties, it will automatically create users in the sonar database the first time they authenticate.

  • Write a Java application that depends on the sonar plugin API, then you can use the constructor installation to get a Sonar sleep session and save the desired user. See here .

+7
source share

Since SonarQube version 3.6, there is support for user management in the webservice API: https://sonarqube.com/web_api/api/users

http://docs.sonarqube.org/display/DEV/Web+API

+2
source share

The web services API does not seem to support user management. Anything is possible, but it doesn't seem to be offered directly through Sonar.

Perhaps you can use some web automation library (webbrowser, webunit, watir, twill) to do this through a working server; perhaps it’s even possible to just use something like β€œcurls” by carefully examining the page source for the users / create form.

Or, if you want to go directly to the database, you can try to pull the user creation functionality out of code and clutter using the sonar.users table directly.

There is an LDAP Plugin that takes care of authentication, but it still requires that you create users in Sonar so that it does not solve your problem.

0
source share

All Articles