From b2bf7c6d8c481a3c33a055c39a6810daa6c80a61 Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Thu, 16 Jun 2022 21:44:46 +0000 Subject: Respect field visibility when filtering/sorting by associated issue fields (#37255). Patch by Holger Just. git-svn-id: https://svn.redmine.org/redmine/trunk@21646 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue_custom_field.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/issue_custom_field.rb') diff --git a/app/models/issue_custom_field.rb b/app/models/issue_custom_field.rb index 18ec6bb43..de5c9ceb2 100644 --- a/app/models/issue_custom_field.rb +++ b/app/models/issue_custom_field.rb @@ -39,7 +39,7 @@ class IssueCustomField < CustomField project_condition = "EXISTS (SELECT 1 FROM #{CustomField.table_name} ifa WHERE ifa.is_for_all = #{self.class.connection.quoted_true} AND ifa.id = #{id_column})" + " OR #{Issue.table_name}.project_id IN (SELECT project_id FROM #{table_name_prefix}custom_fields_projects#{table_name_suffix} WHERE custom_field_id = #{id_column})" - "((#{sql}) AND (#{tracker_condition}) AND (#{project_condition}))" + "((#{sql}) AND (#{tracker_condition}) AND (#{project_condition}) AND (#{Issue.visible_condition(user)}))" end def validate_custom_field -- cgit v1.2.3