Fix edit permissions on overview edit page

https://community.openproject.com/work_packages/24356
pull/6827/head
Oliver Günther 8 years ago
parent b48475c8d0
commit fd2c001c23
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 1
      .travis.yml
  2. 2
      app/views/my_projects_overviews/_block.html.erb
  3. 2
      app/views/my_projects_overviews/_block_textilizable.html.erb
  4. 2
      app/views/my_projects_overviews/blocks/_project_description.html.erb
  5. 7
      spec/features/block_editing_spec.rb

@ -60,7 +60,6 @@ env:
matrix: matrix:
- "TEST_SUITE=plugins:spec DB=mysql GROUP_SIZE=1 GROUP=1" - "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" - "TEST_SUITE=npm"

@ -23,7 +23,7 @@ See doc/COPYRIGHT.md for more details.
<% block_name_id = "my_page_#{block_name}_box_actions" %> <% block_name_id = "my_page_#{block_name}_box_actions" %>
<% content_for block_name_id do %> <% content_for block_name_id do %>
<div class="box-actions"> <div class="box-actions">
<% if User.current.allowed_to?(:remove_block, nil, global: true) %> <% if User.current.allowed_to?(:edit_project, project) %>
<a href="javascript:" <a href="javascript:"
ng-click="$ctrl.remove()" ng-click="$ctrl.remove()"
ng-show="$ctrl.editing" ng-show="$ctrl.editing"

@ -71,7 +71,7 @@ See doc/COPYRIGHT.md for more details.
ng-click="$ctrl.toggleEditForm(true)" ng-click="$ctrl.toggleEditForm(true)"
title="<%= l(:button_edit) %>"></a> title="<%= l(:button_edit) %>"></a>
<% end %> <% end %>
<% if User.current.allowed_to?(:remove_block, nil, global: true) %> <% if User.current.allowed_to?(:edit_project, project) %>
<a href="javascript:" <a href="javascript:"
ng-click="$ctrl.remove()" ng-click="$ctrl.remove()"
class="icon icon-close remove-block" class="icon icon-close remove-block"

@ -31,7 +31,7 @@ See doc/COPYRIGHT.md for more details.
<%= format_text @project.description %> <%= format_text @project.description %>
</div> </div>
<% if current_user.admin? %> <% if current_user.allowed_to?(:edit_project, project) %>
<%= link_to settings_project_path(project), class: 'button -highlight' do %> <%= link_to settings_project_path(project), class: 'button -highlight' do %>
<i class="button--icon icon-edit"></i> <i class="button--icon icon-edit"></i>
<span class="button--text"><%= l(:button_edit) %></span> <span class="button--text"><%= l(:button_edit) %></span>

@ -34,7 +34,12 @@ describe 'My project page editing', type: :feature, js: true do
let(:mypage) { ::Pages::Page.new } let(:mypage) { ::Pages::Page.new }
let(:button_selector) { '.toolbar a.button' } 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 # Add block select
let(:select) { find('#block-select') } let(:select) { find('#block-select') }

Loading…
Cancel
Save