OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
adapt specs
ulferts451d390e6a74
diff --git a/config/initializers/permissions.rb b/config/initializers/permissions.rbindex fc60f5f4d89..3ea58be338d 100644--- a/config/initializers/permissions.rb+++ b/config/initializers/permissions.rb@@ -111,8 +111,7 @@ OpenProject::AccessControl.map do |map|wpt.permission :edit_work_packages,{- :'work_packages/bulk' => %i[edit update],- work_packages: %i[edit update new_type preview quoted]+ :'work_packages/bulk' => %i[edit update]},require: :member,dependencies: :view_work_packages@@ -123,7 +122,11 @@ OpenProject::AccessControl.map do |map|dependencies: :view_work_packageswpt.permission :add_work_package_notes,- {},+ {+ # FIXME: Although the endpoint is removed, the code checking whether a user+ # is eligible to add work packages through the API still seems to rely on this.+ journals: [:new]+ },dependencies: :view_work_packageswpt.permission :edit_work_package_notes,diff --git a/spec/models/users/allowed_to_spec.rb b/spec/models/users/allowed_to_spec.rbindex 8b6a1f89953..f81d5ef748f 100644--- a/spec/models/users/allowed_to_spec.rb+++ b/spec/models/users/allowed_to_spec.rb@@ -405,6 +405,8 @@ describe User, 'allowed_to?' docontext 'w/ requesting a controller and actionw/ the user being allowed the action' do+ let(:permission) { :view_wiki_pages }+before dorole.add_permission! permission@@ -414,7 +416,7 @@ describe User, 'allowed_to?' doendit 'should be true' do- expect(user.allowed_to?({ controller: 'work_packages', action: 'new' }, project))+ expect(user.allowed_to?({ controller: 'wiki', action: 'show' }, project)).to be_truthyendend@@ -486,6 +488,8 @@ describe User, 'allowed_to?' docontext 'w/ the user being a member in the projectw/ inquiring for controller and actionw/ the role having the necessary permission' do+ let(:permission) { :view_wiki_pages }+before dorole.add_permission! permission@@ -495,7 +499,7 @@ describe User, 'allowed_to?' doendit 'should be true' do- expect(user.allowed_to?({ controller: 'work_packages', action: 'new' }, nil, global: true))+ expect(user.allowed_to?({ controller: 'wiki', action: 'show' }, nil, global: true)).to be_truthyendenddiff --git a/spec/permissions/add_work_packages_spec.rb b/spec/permissions/add_work_packages_spec.rbdeleted file mode 100644index 3c5de323537..00000000000--- a/spec/permissions/add_work_packages_spec.rb+++ /dev/null@@ -1,39 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'spec_helper'-require File.expand_path('../../support/permission_specs', __FILE__)--describe WorkPackagesController, 'add_work_packages permission', type: :controller do- include PermissionSpecs-- check_permission_required_for('work_packages#new', :add_work_packages)- check_permission_required_for('work_packages#new_type', :add_work_packages)- check_permission_required_for('work_packages#create', :add_work_packages)- check_permission_required_for('work_packages#preview', :add_work_packages)-enddiff --git a/spec/permissions/edit_journals_spec.rb b/spec/permissions/edit_journals_spec.rbdeleted file mode 100644index 02108b705a9..00000000000--- a/spec/permissions/edit_journals_spec.rb+++ /dev/null@@ -1,37 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'spec_helper'-require File.expand_path('../../support/permission_specs', __FILE__)--describe JournalsController, 'edit permission', type: :controller do- include PermissionSpecs-- check_permission_required_for('journals#edit', :edit_work_package_notes)- check_permission_required_for('journals#edit', :edit_own_work_package_notes)-enddiff --git a/spec/permissions/edit_work_packages_spec.rb b/spec/permissions/edit_work_packages_spec.rbdeleted file mode 100644index 8c93dab21c0..00000000000--- a/spec/permissions/edit_work_packages_spec.rb+++ /dev/null@@ -1,41 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'spec_helper'-require File.expand_path('../../support/permission_specs', __FILE__)--describe WorkPackagesController, 'edit_work_packages permission', type: :controller do- include PermissionSpecs-- check_permission_required_for('work_packages#edit', :edit_work_packages)- check_permission_required_for('work_packages#update', :edit_work_packages)- check_permission_required_for('work_packages#new_type', :edit_work_packages)- check_permission_required_for('work_packages#quoted', :edit_work_packages)-- check_permission_required_for('work_packages#preview', :edit_work_packages)-end