sonarqube

permissions for Administrator accidentally removed


While trying to cleanup a Sonar instance from unwanted users/permissions it seems that the permissions for the Administrator have been withdrawn. We can no longer see the settings menu item (normally appears next to the Administrators login link), cannot change alerts any more ... I have spent a couple of hours now trying to find out where in the DB these permissions reside and hoping to put them back using some insert statements in the DB.

Can someone explain how to put this back? I can login with the Administrator but that is all, no more administrator permissions.


Solution

  • This happens often enough that a FAQ section has been created for it. You'll have to fix it at the database level:

    INSERT INTO user_roles(user_id, role) VALUES ((select id from users where login='mylogin'), 'admin');