the projects filter now only shows project the user may see

git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1727 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
p.tessenow 14 years ago
parent d6ab8fd1b5
commit 5ab34d7d73
  1. 4
      app/models/cost_query/filter/project_id.rb

@ -10,8 +10,8 @@ class CostQuery::Filter::ProjectId < CostQuery::Filter::Base
def self.available_values(user)
map = []
ancestors = []
Project.all.sort_by(&:lft).each do |project|
while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
user.projects.all.sort_by(&:lft).each do |project|
while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
ancestors.pop
end
map << [project.name, project.id, ancestors.size]

Loading…
Cancel
Save