Administration Privileges - Not able to do any admin related activities

Sonar Version : 7.9.1
Can anyone help me in sorting the situation out?

Below are the various outputs from my VM


OS Details
cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.6 (Maipo)


Java version
java -version
openjdk version “11.0.4” 2019-07-16 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.4+11-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.4+11-LTS, mixed mode, sharing)


Microsoft SQL DATABASE

systemctl status mssql-server
● mssql-server.service - Microsoft SQL Server Database Engine
   Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2020-04-10 03:25:48 UTC; 1 months 29 days ago
     Docs: https://docs.microsoft.com/en-us/sql/linux
 Main PID: 48952 (sqlservr)
   CGroup: /system.slice/mssql-server.service
           ├─48952 /opt/mssql/bin/sqlservr
           └─48969 /opt/mssql/bin/sqlservr

List of Databases 
1> SELECT Name from sys.Databases
2> GO
Name
--------------------------------------------------------------------------------------------------------------------------------
master
tempdb
model
msdb
sonar

(5 rows affected)

Screen shot from GUI


Lost administration tab for admin user or regular user which was created

Because of this we are not able to add any new user who wants to access our projects on SonarQube

Please help me with required steps to have the admin tab again…
Let me know if any information is still required.

Thanks in Advance

Hi,

The docs on reinstating admin access should help.

 
Ann

Hi Ann
I tried running the query by logging to our database…
I see the following error
1> INSERT INTO user_roles(user_id, role, organization_uuid)
2> VALUES ((select id from users where login=‘mylogin’),
3> ‘admin’,
4> (select uuid from organizations where kee=‘default-organization’));
5> GO
Msg 208, Level 16, State 1, Server azrsonarqube01, Line 1
Invalid object name ‘users’.

Hi,

Are you sure you were targeting the right schema?

 
Ann

Hi Ann,
I am no DBA, but had to fix this thing as all of my team is on Vacation.
I tried a lot many times and figured out the list of schema’s we have in our database. I have listed them below.Can you please suggest which one to use ?

schema_name
--------------------------
--------------------------
db_accessadmin
db_backupoperator
db_datareader
db_datawriter
db_ddladmin
db_denydatareader
db_denydatawriter
db_owner
db_securityadmin
dbo
guest
INFORMATION_SCHEMA
sys

Hi,

I doubt any of these is the right one; none of them have ‘sonar’ in the name.

 
Ann

Hi Ann,

I was able to execute the insert command you suggested from sonar documentation
this is the output
1> INSERT INTO user_roles(user_id, role, organization_uuid)
2> VALUES ((select id from users where login=‘mylogin’),
3> ‘admin’, (select uuid from organizations where kee=‘default-organization’));
4> go

(1 rows affected)

I see one row got effected
Do I need to restart the sonar process to have the change effected to the dashboard ?

Hi,

No need to restart the server. You may need to force-refresh your browser. Worst case, log out & back in.

 
Ann

It worked Ann, Thanks for the help
Saved my day