class JobTaskController < ApplicationController
  layout "default"
  
  def index
    @job_tasks = JobTask.paginate(:per_page => 25, :order => "id DESC", :page => params[:page])
  end
  
  def show
    @job_task = JobTask.find(params[:id])
    
    if @job_task.task_type == "upload_post" && @job_task.status == "finished"
      redirect_to :controller => "post", :action => "show", :id => @job_task.status_message
    end
  end
  
  def destroy
    @job_task = JobTask.find(params[:id])

    if request.post?
      @job_task.destroy
      redirect_to :action => "index"
    end
  end

  def restart
    @job_task = JobTask.find(params[:id])

    if request.post?
      @job_task.update_attributes!(:status => "pending", :status_message => "")
      redirect_to :action => "show", :id => @job_task.id
    end
  end
end

class JobTaskController < ApplicationController
  layout "default"

  before_filter :admin_only, :only => [ :destroy, :restart ]
  
  def index
    @job_tasks = JobTask.paginate(:per_page => 25, :order => "id DESC", :page => params[:page])
  end
  
  def show
    @job_task = JobTask.find(params[:id])
    
    if @job_task.task_type == "upload_post" && @job_task.status == "finished"
      redirect_to :controller => "post", :action => "show", :id => @job_task.status_message
    end
  end
  
  def destroy
    @job_task = JobTask.find(params[:id])

    if request.post?
      @job_task.destroy
      redirect_to :action => "index"
    end
  end

  def restart
    @job_task = JobTask.find(params[:id])

    if request.post?
      @job_task.update_attributes!(:status => "pending", :status_message => "")
      redirect_to :action => "show", :id => @job_task.id
    end
  end
end

Access control for job task restart/destroy
r1901: Access control for job task restart/destroy

--HG--
branch : moe
extra : convert_revision : svn%3A2d28d66d-8d94-df11-8c86-00306ef368cb/trunk/moe%40279
