issues_controller.rb.patch

Alain Alain091, 2010-05-02 10:44

Download (1.96 KB)

View differences:

issues_controller.rb (working copy)
353 353
    projects = @issues.collect(&:project).compact.uniq
354 354
    @project = projects.first if projects.size == 1
355 355

  
356
    @can = {:edit => (@project && User.current.allowed_to?(:edit_issues, @project)),
357
            :log_time => (@project && User.current.allowed_to?(:log_time, @project)),
358
            :update => (@project && (User.current.allowed_to?(:edit_issues, @project) || (User.current.allowed_to?(:change_status, @project) && @allowed_statuses && !@allowed_statuses.empty?))),
359
            :move => (@project && User.current.allowed_to?(:move_issues, @project)),
360
            :copy => (@issue && @project.trackers.include?(@issue.tracker) && User.current.allowed_to?(:add_issues, @project)),
361
            :delete => (@project && User.current.allowed_to?(:delete_issues, @project))
356
	edit, log_time, update, move, copy, delete = true, true, true, true, true, true
357
	
358
	projects.each do |project|
359
	    edit &= (@project && User.current.allowed_to?(:edit_issues, @project))
360
        log_time &= (@project && User.current.allowed_to?(:log_time, @project))
361
        update &= (@project && (User.current.allowed_to?(:edit_issues, @project) || (User.current.allowed_to?(:change_status, @project) && @allowed_statuses && !@allowed_statuses.empty?)))
362
        move &= (@project && User.current.allowed_to?(:move_issues, @project))
363
        copy &= (@issue && @project.trackers.include?(@issue.tracker) && User.current.allowed_to?(:add_issues, @project))
364
        delete &= (@project && User.current.allowed_to?(:delete_issues, @project))
365
	end
366
	
367
    @can = {:edit => edit,
368
            :log_time => log_time,
369
            :update => update,
370
            :move => move,
371
            :copy => copy,
372
            :delete => delete
362 373
            }
363 374
    if @project
364 375
      @assignables = @project.assignable_users