Skip to content

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

Also check that the project is not archived

Klaus Zanders713a9c9ce831
diff --git a/app/services/authorization/user_permissible_service.rb b/app/services/authorization/user_permissible_service.rb
index 2eea505fc3c..2403f5fa9a5 100644
--- a/app/services/authorization/user_permissible_service.rb
+++ b/app/services/authorization/user_permissible_service.rb
@@ -93,6 +93,7 @@ module Authorization
def allowed_in_single_entity?(permissions, entity)
return false if entity.nil?
+ return false unless entity.project.active? || entity.project.being_archived?
permissions_filtered_for_project = permissions_by_enabled_project_modules(entity.project, permissions)
diff --git a/spec/services/authorization/user_permissible_service_spec.rb b/spec/services/authorization/user_permissible_service_spec.rb
index bd08eaf151d..c68c540aa76 100644
--- a/spec/services/authorization/user_permissible_service_spec.rb
+++ b/spec/services/authorization/user_permissible_service_spec.rb
@@ -61,6 +61,12 @@ RSpec.describe Authorization::UserPermissibleService do
let!(:project_member) { create(:member, user:, project:, roles: [role]) }
it { is_expected.to be_allowed_in_project(permission, project) }
+
+ context 'but the project is archived' do
+ before { project.update(active: false) }
+
+ it { is_expected.not_to be_allowed_in_project(permission, project) }
+ end
end
context 'and the user is a member of a work package' do
@@ -127,6 +133,12 @@ RSpec.describe Authorization::UserPermissibleService do
let!(:project_member) { create(:member, user:, project:, roles: [role]) }
it { is_expected.to be_allowed_in_entity(permission, work_package, WorkPackage) }
+
+ context 'but the project is archived' do
+ before { project.update(active: false) }
+
+ it { is_expected.not_to be_allowed_in_entity(permission, work_package, WorkPackage) }
+ end
end
context 'and the user is a member of the work package' do
@@ -134,6 +146,12 @@ RSpec.describe Authorization::UserPermissibleService do
let!(:wp_member) { create(:work_package_member, user:, project:, entity: work_package, roles: [role]) }
it { is_expected.to be_allowed_in_entity(permission, work_package, WorkPackage) }
+
+ context 'but the project is archived' do
+ before { project.update(active: false) }
+
+ it { is_expected.not_to be_allowed_in_entity(permission, work_package, WorkPackage) }
+ end
end
context 'and a user is a member of the project (not granting the permission) and the work package (granting the permission)' do