Project

General

Profile

Patch #37565 ยป patch.diff

Vincent Robert, 2022-08-09 15:22

View differences:

app/models/issue_custom_field.rb
" 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}) AND (#{Issue.visible_condition(user)}))"
"((#{sql}) AND (#{tracker_condition}) AND (#{project_condition}) AND (#{Issue.visible_condition(user, {skip_pre_condition: true})}))"
end
def validate_custom_field
app/models/project.rb
# * :member => true limit the condition to the user projects
def self.allowed_to_condition(user, permission, options={})
perm = Redmine::AccessControl.permission(permission)
base_statement =
if perm && perm.read?
if options[:skip_pre_condition]
base_statement = "1=1"
else
base_statement = if perm && perm.read?
"#{Project.table_name}.status <> #{Project::STATUS_ARCHIVED}"
else
"#{Project.table_name}.status = #{Project::STATUS_ACTIVE}"
end
if !options[:skip_pre_condition] && perm && perm.project_module
# If the permission belongs to a project module, make sure the module is enabled
base_statement +=
" AND EXISTS (SELECT 1 AS one FROM #{EnabledModule.table_name} em" \
" WHERE em.project_id = #{Project.table_name}.id" \
" AND em.name='#{perm.project_module}')"
if perm && perm.project_module
# If the permission belongs to a project module, make sure the module is enabled
base_statement +=
" AND EXISTS (SELECT 1 AS one FROM #{EnabledModule.table_name} em" \
" WHERE em.project_id = #{Project.table_name}.id" \
" AND em.name='#{perm.project_module}')"
end
end
if project = options[:project]
project_statement = project.project_condition(options[:with_subprojects])
    (1-1/1)