]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6004 Apply project permissions on global dashboards
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Mon, 16 Feb 2015 13:32:17 +0000 (14:32 +0100)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Mon, 16 Feb 2015 13:32:17 +0000 (14:32 +0100)
server/sonar-web/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb

index b89642448987a02ca167792338d1aefa66212c4d..1dd755911999b558670efc757f701747bcf78f65 100644 (file)
@@ -158,7 +158,11 @@ module DashboardHelper
 
     if widget.configured
       begin
-        widget_body=render :inline => widget.java_definition.getTarget().getTemplate(), :locals => {:widget_properties => widget.properties_as_hash, :widget => widget, :dashboard_configuration => @dashboard_configuration}
+        if has_role?(:user, @resource)
+          widget_body=render :inline => widget.java_definition.getTarget().getTemplate(), :locals => {:widget_properties => widget.properties_as_hash, :widget => widget, :dashboard_configuration => @dashboard_configuration}
+        else
+          widget_body=message 'not_authorized_to_access_project', h(@resource.name)
+        end
       rescue => error
         logger.error(message('dashboard.cannot_render_widget_x', :params => [widget.java_definition.getId(), error]), error)
       end