编辑作品:当前用户为作品的作者 && (未开启匿评 || 未启用匿评)

This commit is contained in:
sw 2015-05-21 17:33:54 +08:00
parent bf63ca7854
commit 289fb393bf
1 changed files with 3 additions and 2 deletions

View File

@ -81,7 +81,8 @@ class StudentWorkController < ApplicationController
#获取作品
def find_work
@work = StudentWork.find params[:id]
@course = @work.homework_common.course
@homework = @work.homework_common
@course = @homework.course
rescue
render_404
end
@ -95,6 +96,6 @@ class StudentWorkController < ApplicationController
#判断是不是当前作品的提交者
#提交者可以编辑作品
def author_of_work
render_403 unless User.current.id == @work.user_id
render_403 unless User.current.id == @work.user_id && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
end
end