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

handle nil/empty explicitly

ulfertsa17991b85c77
diff --git a/app/services/authorization/user_allowed_service.rb b/app/services/authorization/user_allowed_service.rb
index 4b8138e73c9..27bc85b5474 100644
--- a/app/services/authorization/user_allowed_service.rb
+++ b/app/services/authorization/user_allowed_service.rb
@@ -95,7 +95,7 @@ class Authorization::UserAllowedService
# Authorize if user is authorized on every element of the array
def allowed_to_in_all_projects?(action, projects)
- Array(projects).all? do |project|
+ projects.present? && Array(projects).all? do |project|
allowed_to?(action, project)
end
end