project_visible_condition.diff

right patch - Ondřej Ezr, 2016-01-03 11:31

Download (953 Bytes)

View differences:

app/models/project.rb
174 174
    base_statement = (perm && perm.read? ? "#{Project.table_name}.status <> #{Project::STATUS_ARCHIVED}" : "#{Project.table_name}.status = #{Project::STATUS_ACTIVE}")
175 175
    if perm && perm.project_module
176 176
      # If the permission belongs to a project module, make sure the module is enabled
177
      base_statement << " AND #{Project.table_name}.id IN (SELECT em.project_id FROM #{EnabledModule.table_name} em WHERE em.name='#{perm.project_module}')"
177
      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}')"
178 178
    end
179 179
    if project = options[:project]
180 180
      project_statement = project.project_condition(options[:with_subprojects])