课程删除帖子权限控制

dev_forum
daiao 5 years ago
parent b8521f73e5
commit 036037df22

@ -44,12 +44,18 @@ class CommonsController < ApplicationController
def validate_power
code =
case params[:object_type].strip
when 'message', 'journals_for_message'
when 'message'
if current_user.course_identity(@object.board.course) >= Course::STUDENT && @object.author != current_user
403
else
200
end
when 'journals_for_message'
if current_user.course_identity(@object.jour.course) >= Course::STUDENT && @object.user != current_user
403
else
200
end
else
current_user.admin? ? 200 : 403
end

Loading…
Cancel
Save