aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/resource_controller.rb
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-02-22 00:33:15 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-02-22 00:33:15 +0100
commit323ace33d564b236e17bce37c8513ee0148aa262 (patch)
tree76197f8c44109aaa24904f30a49fabe91f5c7507 /sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/resource_controller.rb
parent58d94501900849959346beb5988454122c623470 (diff)
downloadsonarqube-323ace33d564b236e17bce37c8513ee0148aa262.tar.gz
sonarqube-323ace33d564b236e17bce37c8513ee0148aa262.zip
SONAR-3208 new extension point to declare tree of resource types
* new extension point org.sonar.api.resources.ResourceTypeTree * new component org.sonar.api.resources.ResourceTypes to access resource types * fix compatibility of hotspots, clouds and treemaps with PROJECT_MEASURES.PERSON_ID * ApplicationController share ruby methods to load the selected resource
Diffstat (limited to 'sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/resource_controller.rb')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/resource_controller.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/resource_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/resource_controller.rb
index 61ffbcd6c9d..4b835e19d4b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/resource_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/plugins/resource_controller.rb
@@ -23,10 +23,11 @@ class Plugins::ResourceController < ApplicationController
helper :project
def index
- @project = ::Project.by_key(params[:id])
- not_found("Not found") unless @project
+ @resource = ::Project.by_key(params[:id])
+ not_found("Not found") unless @resource
+ @project=@resource # for backward-compatibility
- @snapshot=@project.last_snapshot
+ @snapshot=@resource.last_snapshot
page_id=params[:page]
@page_proxy=java_facade.getPage(page_id)
@@ -36,7 +37,7 @@ class Plugins::ResourceController < ApplicationController
authorized=@page_proxy.getUserRoles().size==0
unless authorized
@page_proxy.getUserRoles().each do |role|
- authorized= (role=='user') || (role=='viewer') || has_role?(role, @project)
+ authorized= (role=='user') || (role=='viewer') || has_role?(role, @resource)
break if authorized
end
end