|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
class TaskBanksController < ApplicationController
|
|
|
|
|
before_action :require_login
|
|
|
|
|
before_action :find_bank
|
|
|
|
|
before_action :bank_visit_auth
|
|
|
|
|
before_action :bank_admin, only: [:update]
|
|
|
|
|
|
|
|
|
|
def show
|
|
|
|
@ -25,8 +26,6 @@ class TaskBanksController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def find_bank
|
|
|
|
|
@bank = GtaskBank.find_by!(id: params[:id])
|
|
|
|
|
tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? ||
|
|
|
|
|
(current_user.certification_teacher? && @bank.is_public)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def bank_admin
|
|
|
|
|