diff --git a/app/controllers/graduation_works_controller.rb b/app/controllers/graduation_works_controller.rb index 09b9146e8..7cf1a3393 100644 --- a/app/controllers/graduation_works_controller.rb +++ b/app/controllers/graduation_works_controller.rb @@ -13,6 +13,7 @@ class GraduationWorksController < ApplicationController before_action :published_task, only: [:new, :create, :edit, :update, :search_member_list, :relate_project, :cancel_relate_project, :revise_attachment] before_action :edit_duration, only: [:edit, :update] + before_action :open_work, only: [:show, :supply_attachments, :comment_list] def new if @task.task_type == 2 && @task.base_on_project @@ -489,6 +490,11 @@ class GraduationWorksController < ApplicationController tip_exception("已过了修改时间") if @task.end_time && @task.end_time < Time.now end + # 作品是否公开 + def open_work + tip_exception(403,"没有操作权限") unless (@user_course_identity < Course::STUDENT || current_user == @work.user || @task.open_work) + end + def update_check work tip_exception("作品描述不能为空") if params[:description].blank? if @task.task_type == 2