aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/webapp
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2016-09-23 11:24:15 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2016-09-28 17:36:48 +0200
commit4cd20ab6fd2459a5c29483479c15d7c37119e90d (patch)
tree6a596664797895eed85256358e83971a236edbc0 /server/sonar-web/src/main/webapp
parentdb7601137d65cb0a7c0c8facf5693b5bfc7c593e (diff)
downloadsonarqube-4cd20ab6fd2459a5c29483479c15d7c37119e90d.tar.gz
sonarqube-4cd20ab6fd2459a5c29483479c15d7c37119e90d.zip
SONAR-8173 drop global permission "shareDashboard"
Diffstat (limited to 'server/sonar-web/src/main/webapp')
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb6
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/models/dashboard.rb4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/models/measure_filter.rb2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_shared_form.html.erb4
6 files changed, 10 insertions, 10 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb
index a7029e3bc09..7baf8e59600 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb
@@ -180,7 +180,7 @@ class DashboardsController < ApplicationController
def load_dashboard_from_params(dashboard)
dashboard.name = params[:name]
dashboard.description = params[:description]
- dashboard.shared = params[:shared].present? && has_role?(:shareDashboard)
+ dashboard.shared = params[:shared].present?
dashboard.column_layout = Dashboard::DEFAULT_LAYOUT if !dashboard.column_layout
dashboard.user = User.find_active_by_login(params[:owner]) unless params[:owner].nil?
end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb
index de7a8665353..4d4ea18e494 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb
@@ -92,7 +92,7 @@ class MeasuresController < ApplicationController
end
@filter.name=params[:name]
@filter.description=params[:description]
- @filter.shared=(params[:shared]=='true') && has_role?(:shareDashboard)
+ @filter.shared=(params[:shared]=='true')
@filter.data=URI.unescape(params[:data])
if @filter.save
current_user.favourited_measure_filters<<@filter if add_to_favourites
@@ -145,7 +145,7 @@ class MeasuresController < ApplicationController
@filter.name=params[:name]
@filter.description=params[:description]
- @filter.shared=(params[:shared]=='true') && has_role?(:shareDashboard)
+ @filter.shared=(params[:shared]=='true')
if has_role?(:admin) && params[:owner]
@filter.user = User.find_by_login(params[:owner])
end
@@ -181,7 +181,7 @@ class MeasuresController < ApplicationController
target.name=params[:name]
target.description=params[:description]
target.user_id=current_user.id
- target.shared=(params[:shared]=='true') && has_role?(:shareDashboard)
+ target.shared=(params[:shared]=='true')
target.data=source.data
if target.save
current_user.favourited_measure_filters << target
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/dashboard.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/dashboard.rb
index d735bf86d0e..1dcbfbd7b44 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/dashboard.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/dashboard.rb
@@ -45,7 +45,7 @@ class Dashboard < ActiveRecord::Base
end
def user_rights_consistency
- if shared? && user && !user.has_role?(:shareDashboard)
+ if shared? && !user
errors.add(:user, "cannot own this dashboard because of insufficient rights")
end
end
@@ -79,7 +79,7 @@ class Dashboard < ActiveRecord::Base
end
def can_be_shared_by(user)
- owner?(user) && user.has_role?(:shareDashboard)
+ owner?(user)
end
def can_be_reassigned_by(user)
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/measure_filter.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/measure_filter.rb
index e7d07a86d11..46fcb766648 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/measure_filter.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/measure_filter.rb
@@ -361,7 +361,7 @@ class MeasureFilter < ActiveRecord::Base
errors.add_to_base('Other users already share filters with the same name') if count>0
# Verify filter owner has sharing permission
- if user && !user.has_role?(:shareDashboard)
+ if !user
errors.add(:user, "cannot own this filter because of insufficient rights")
end
elsif system?
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb
index c79ab4b210f..c139061537b 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb
@@ -18,7 +18,7 @@
<label for="description"><%= h message('description') -%></label>
<input id="description" name="description" type="text" size="50" maxlength="4000" value="<%= h @dashboard.description -%>"/>
</div>
- <% if has_role?(:shareDashboard) %>
+ <% if logged_in? %>
<div class="modal-field">
<label for="shared"><%= h message('shared') -%></label>
<input id="shared" name="shared" type="checkbox" value="true" <%= 'checked' if @dashboard.shared -%>/>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_shared_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_shared_form.html.erb
index b670d2655fd..c53de5eab58 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_shared_form.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_shared_form.html.erb
@@ -17,7 +17,7 @@
<%= user_select_tag('owner', :html_id => 'select-filter-owner', :selected_user => @filter.user) -%>
</div>
<% end %>
- <% if has_role?(:shareDashboard) %>
+ <% if logged_in? %>
<% if @filter.user_id.nil? || @filter.user_id == current_user.id %>
<div class="modal-field">
<label for="shared"><%= h message('measure_filter.shared_with_all_users') -%></label>
@@ -27,4 +27,4 @@
<input id="shared" name="shared" type="hidden" value="<%= @filter.shared -%>"/>
<% end %>
<% end %>
-</div> \ No newline at end of file
+</div>