|
|
@ -2,7 +2,8 @@ class LiveLinksController < ApplicationController
|
|
|
|
before_action :require_login
|
|
|
|
before_action :require_login
|
|
|
|
before_action :find_course, only: [:index, :create]
|
|
|
|
before_action :find_course, only: [:index, :create]
|
|
|
|
before_action :user_course_identity, :teacher_allowed, only: [:create]
|
|
|
|
before_action :user_course_identity, :teacher_allowed, only: [:create]
|
|
|
|
before_action :edit_auth, only: [:edit, :update, :destroy]
|
|
|
|
before_action :edit_auth, only: [:edit, :update]
|
|
|
|
|
|
|
|
before_action :delete_auth, only: [:destroy]
|
|
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
def index
|
|
|
|
lives = @course.live_links
|
|
|
|
lives = @course.live_links
|
|
|
@ -58,6 +59,10 @@ class LiveLinksController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def edit_auth
|
|
|
|
def edit_auth
|
|
|
|
|
|
|
|
tip_exception(403, "无权限操作") unless current_user.id == current_live.user_id || current_user.admin_or_business?
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def delete_auth
|
|
|
|
tip_exception(403, "无权限操作") unless current_user.id == current_live.user_id || current_user.admin?
|
|
|
|
tip_exception(403, "无权限操作") unless current_user.id == current_live.user_id || current_user.admin?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|