issues_controller.rb.patch

Alain Alain091, 2010-05-01 19:58

Download (1.99 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 = false
357
	log_time = false
358
	update = false
359
	move = false
360
	copy = false
361
	delete = false
362
	
363
	projects.each_value do |project|
364
	    edit &= (@project && User.current.allowed_to?(:edit_issues, @project))
365
        log_time &= (@project && User.current.allowed_to?(:log_time, @project)),
366
        update &= (@project && (User.current.allowed_to?(:edit_issues, @project) || (User.current.allowed_to?(:change_status, @project) && @allowed_statuses && !@allowed_statuses.empty?))),
367
        move &= (@project && User.current.allowed_to?(:move_issues, @project)),
368
        copy &= @issue && @project.trackers.include?(@issue.tracker) && User.current.allowed_to?(:add_issues, @project)),
369
        delete &= (@project && User.current.allowed_to?(:delete_issues, @project))
370
	end
371
	
372
    @can = {:edit => edit,
373
            :log_time => log_time,
374
            :update => update,
375
            :move => move,
376
            :copy => copy,
377
            :delete => delete
362 378
            }
363 379
    if @project
364 380
      @assignables = @project.assignable_users