|
|
|
@ -49,6 +49,21 @@ module ApplicationHelper
|
|
|
|
|
return result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 判断某个资源是否可以申请
|
|
|
|
|
def attach_show_allow attach_id
|
|
|
|
|
attachment = Attachment.find(attach_id)
|
|
|
|
|
case attachment.container_type
|
|
|
|
|
when "Project"
|
|
|
|
|
User.current.member_of?(attachment.container) ? true : false
|
|
|
|
|
when "Course"
|
|
|
|
|
User.current.member_of_course?(attachment.container) ? true : false
|
|
|
|
|
when "OrgSubfield"
|
|
|
|
|
User.current.member_of_org?(attachment.container) ? true : false
|
|
|
|
|
when "Principal"
|
|
|
|
|
User.current.id == attachment.author_id ? true : false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# Time 2015-03-24 15:27:29
|
|
|
|
|
# Author lizanle
|
|
|
|
|
# Description 从硬盘上删除对应的资源文件
|
|
|
|
|