-1

I need to find the list of users and group associated with project in SonarQube.

I try to find tables user_roles and group_roles that have a column resource_id. This can be used to get corresponding kee value in table resource_index. This kee value is not same as projects file kee value.

Select * 
into #TempTblSnprjusrs
From 
    (Select 
         users.login "lanid", users.name "Name", resource_index.kee "Kee"
     from 
         user_roles, resource_index, users
     Where 
         resource_index.resource_id = user_roles.resource_id 
         and users.id = user_roles.user_id) as x;

But we cannot get corresponding values of kee in projects table.

Select Distinct 
    #TempTblSnprjusrs.lanid, #TempTblSnprjusrs.Name,                   
    #TempTblSnprjusrs.kee, projects.Name 
from 
    #TempTblSnprjusrs
join 
    projects on projects.kee =  #TempTblSnprjusrs.Project_key;
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Sanjoy Roy
  • 31
  • 1
  • 1
  • 5
  • [Bad habits to kick : using old-style JOINs](https://sqlblog.org/2009/10/08/bad-habits-to-kick-using-old-style-joins) - that old-style *comma-separated list of tables* style was replaced with the *proper* ANSI `JOIN` syntax in the ANSI-**92** SQL Standard (**more than 20 years** ago) and its use is discouraged – marc_s Mar 14 '16 at 10:57

1 Answers1

2

The database is not an API.

To get the users and groups associated with a project permission-wise, use the Administrative Security interface. Otherwise, you'll want the permissions web services.

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76
  • Using Administrative Security interface is through Sonar application. But I want a report on number of SonarQube users project wise. To do so I need to run a SQL query in the database. So I need to get the right kee value to search the Projects table. – Sanjoy Roy Mar 15 '16 at 21:54