|
|
|
@ -136,22 +136,16 @@ class CollegesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def require_login
|
|
|
|
|
return if User.current.logged?
|
|
|
|
|
|
|
|
|
|
redirect_to "/login?back_url=#{CGI::escape(request.fullpath)}"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def check_college_present!
|
|
|
|
|
return if current_college.present?
|
|
|
|
|
|
|
|
|
|
redirect_to '/404'
|
|
|
|
|
tip_exception(404, "")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def check_manage_permission!
|
|
|
|
|
return if can_manage_college?
|
|
|
|
|
|
|
|
|
|
redirect_to '/403'
|
|
|
|
|
tip_exception(403, "")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def can_manage_college?
|
|
|
|
@ -160,7 +154,7 @@ class CollegesController < ApplicationController
|
|
|
|
|
return true if current_user.is_teacher? && current_user.school_id == current_school.id # 学校老师
|
|
|
|
|
# return true if current_school.customers.exists? && current_user.partner&.partner_customers&.exists?(customer_id: current_school.customer_id)
|
|
|
|
|
|
|
|
|
|
false
|
|
|
|
|
tip_exception(403, "")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def current_school
|
|
|
|
|