修改作品权限对admin用户公开

This commit is contained in:
sw 2015-07-22 10:18:01 +08:00
parent 5bd1cdc4eb
commit ec4395c30c
1 changed files with 2 additions and 2 deletions

View File

@ -157,7 +157,7 @@ class StudentWorkController < ApplicationController
end
def edit
if @homework.homework_type == 2 #编程作业不能修改作业
if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业
render_403
else
respond_to do |format|
@ -445,7 +445,7 @@ class StudentWorkController < ApplicationController
#判断是不是当前作品的提交者
#提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品
def author_of_work
render_403 unless (User.current.id == @work.user_id || User.current.admin?) && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
render_403 unless User.current.admin? || (User.current.id == @work.user_id && @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
end
def teacher_of_course