|
|
|
@ -65,16 +65,62 @@ class ApplicationController < ActionController::Base
|
|
|
|
|
include Redmine::MenuManager::MenuController
|
|
|
|
|
helper Redmine::MenuManager::MenuHelper
|
|
|
|
|
|
|
|
|
|
def ecloud_auth ucloud_user_id
|
|
|
|
|
euser = EcloudUser.where("id =? and opttype not in(3, 5)", ucloud_user_id).first
|
|
|
|
|
if euser.present? # 开通过业务
|
|
|
|
|
# ni
|
|
|
|
|
# 云启训练场(EduCoder)个人版 产品编码(appId) 9200108
|
|
|
|
|
# 产品名称 计费类型 套餐编码
|
|
|
|
|
# 云启训练场(EduCoder)个人版 固定包月 9200108001
|
|
|
|
|
# 固定包月 9200108002
|
|
|
|
|
# 固定包月 9200108003
|
|
|
|
|
# ---------------------------------------------------
|
|
|
|
|
# 产品名称 计费类型 套餐编码
|
|
|
|
|
# 云启训练场(EduCoder))院校版 包月+按license 9200109001
|
|
|
|
|
# 包月+按license 9200109002
|
|
|
|
|
|
|
|
|
|
# 云启训练场(EduCoder))院校版 产品编码(appId) 9200109
|
|
|
|
|
def ecloud_auth subject_id
|
|
|
|
|
# euser = EcloudUser.where("userid =? and opttype not in(3, 5)", User.current.id).first
|
|
|
|
|
# if euser.present? # 开通过业务
|
|
|
|
|
# # 获取用户的套餐信息
|
|
|
|
|
# e_service = euser.ecloud_services.where("opttype != 1")
|
|
|
|
|
# # 如果用户开通过服务
|
|
|
|
|
# if e_service.present?
|
|
|
|
|
# if e_service.count >1 # 说明有重复开通过业务
|
|
|
|
|
# else
|
|
|
|
|
# code = e_service.first.try(:code)
|
|
|
|
|
#
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
# else
|
|
|
|
|
# false # 没开通过服务,或者服务被禁用则不允许访问
|
|
|
|
|
# end
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# if e_service.count > 1 # 说明有重复订购过套餐
|
|
|
|
|
# else
|
|
|
|
|
# code = e_service.try(:code)
|
|
|
|
|
# end
|
|
|
|
|
# service_count = euser.ecloud_services.where("opttype != 1").try(:code)
|
|
|
|
|
#
|
|
|
|
|
# end
|
|
|
|
|
# 如果不是Ecloud过来的用户,则不改变用户的使用状态及权限,按现有模式即可
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
false
|
|
|
|
|
# 根据业务确定权限
|
|
|
|
|
def ecloud_services_auth code, subject_id
|
|
|
|
|
subject = Subject.find(subject_id)
|
|
|
|
|
subject_level = subject.subject_level_system.try(:level)
|
|
|
|
|
case code
|
|
|
|
|
when "9200108001"
|
|
|
|
|
subject_level.to_i == 1 ? true : false
|
|
|
|
|
when "9200108002"
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def ec_public_auth major_school
|
|
|
|
|
unless User.current.admin? || major_school.template_major || major_school.school.users.where(:id => User.current.id).count > 0 ||
|
|
|
|
|
major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0 ||
|
|
|
|
|