From fd2c001c237cbf98cbae72f027e36ce51fdd2011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 23 Nov 2016 10:51:46 +0100 Subject: [PATCH] Fix edit permissions on overview edit page https://community.openproject.com/work_packages/24356 --- .travis.yml | 1 - app/views/my_projects_overviews/_block.html.erb | 2 +- .../my_projects_overviews/_block_textilizable.html.erb | 2 +- .../blocks/_project_description.html.erb | 2 +- spec/features/block_editing_spec.rb | 7 ++++++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 91890d7123..44842a1a27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,7 +60,6 @@ env: matrix: - "TEST_SUITE=plugins:spec DB=mysql GROUP_SIZE=1 GROUP=1" - - "TEST_SUITE=plugins:cucumber DB=mysql GROUP_SIZE=1 GROUP=1" - "TEST_SUITE=npm" diff --git a/app/views/my_projects_overviews/_block.html.erb b/app/views/my_projects_overviews/_block.html.erb index 4b5a1631e5..f9f49925df 100644 --- a/app/views/my_projects_overviews/_block.html.erb +++ b/app/views/my_projects_overviews/_block.html.erb @@ -23,7 +23,7 @@ See doc/COPYRIGHT.md for more details. <% block_name_id = "my_page_#{block_name}_box_actions" %> <% content_for block_name_id do %>
- <% if User.current.allowed_to?(:remove_block, nil, global: true) %> + <% if User.current.allowed_to?(:edit_project, project) %> <% end %> - <% if User.current.allowed_to?(:remove_block, nil, global: true) %> + <% if User.current.allowed_to?(:edit_project, project) %>
-<% if current_user.admin? %> +<% if current_user.allowed_to?(:edit_project, project) %> <%= link_to settings_project_path(project), class: 'button -highlight' do %> <%= l(:button_edit) %> diff --git a/spec/features/block_editing_spec.rb b/spec/features/block_editing_spec.rb index 12c00425d8..d285be9d5b 100644 --- a/spec/features/block_editing_spec.rb +++ b/spec/features/block_editing_spec.rb @@ -34,7 +34,12 @@ describe 'My project page editing', type: :feature, js: true do let(:mypage) { ::Pages::Page.new } let(:button_selector) { '.toolbar a.button' } - let(:user) { FactoryGirl.create :admin } + + let(:user) { FactoryGirl.create :user, + member_in_project: project, + member_through_role: role } + let(:role) { FactoryGirl.create :role, permissions: [:view_project, + :edit_project] } # Add block select let(:select) { find('#block-select') }