From: Jean-Philippe Lang Date: Wed, 20 Nov 2019 15:53:04 +0000 (+0000) Subject: Make sure we cannot create a ProjectQuery on a given project (#29482). X-Git-Tag: 4.2.0~1544 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=97efebf08eb9d6ea6aec27674a186b06525547a3;p=redmine.git Make sure we cannot create a ProjectQuery on a given project (#29482). git-svn-id: http://svn.redmine.org/redmine/trunk@19093 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/project_query.rb b/app/models/project_query.rb index 49c8f5e99..5957ecb41 100644 --- a/app/models/project_query.rb +++ b/app/models/project_query.rb @@ -22,6 +22,11 @@ class ProjectQuery < Query self.queried_class = Project self.view_permission = :search_project + validate do |query| + # project must be blank for ProjectQuery + errors.add(:project_id, :exclusion) if query.project_id.present? + end + self.available_columns = [ QueryColumn.new(:name, :sortable => "#{Project.table_name}.name"), QueryColumn.new(:status, :sortable => "#{Project.table_name}.status"),