ruby-on-railsrubysonarqube

How can I get current project id in SonarQube plugin?


How can I get current project id from Ruby ApplicationController class?

The code is executed from SonarQube menu (SECTION=Navigation::SECTION_RESOURCE) so I cannot pass any parameters.

The ultimate goal is to check user's permissions for the current project, so if it can be done without project id it will be also a valid solution.


Solution

  • I solved the problem by calling Project.by_key(params[:id]) Sonar passes the the project key as id request parameter.