竞赛讨论区帖子上传的附件,点击无法下载,提示无访问权限
This commit is contained in:
parent
2dab7d81ff
commit
0de116c0af
|
@ -367,6 +367,8 @@ class ApplicationController < ActionController::Base
|
|||
allowed = User.current.allowed_to?(:projects_attachments_download,@project,:global => false)
|
||||
elsif @course
|
||||
allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false)
|
||||
elsif @contest
|
||||
allowed = User.current.member_of_contest?(@contest)
|
||||
end
|
||||
when "contest"
|
||||
return true
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
class AttachmentsController < ApplicationController
|
||||
layout "users_base"
|
||||
|
||||
before_filter :verify_authenticity_token, only: [:uploa]
|
||||
before_filter :verify_authenticity_token, only: [:upload]
|
||||
|
||||
before_filter :find_project, :only => [:show, :download, :thumbnail, :destroy, :delete_homework]#, :except => [:upload, :autocomplete]
|
||||
before_filter :file_readable, :read_authorize, :only => [:show, :thumbnail]#Modified by young
|
||||
|
@ -694,6 +694,9 @@ class AttachmentsController < ApplicationController
|
|||
elsif !@attachment.container.nil? && ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) && @attachment.container.board &&
|
||||
@attachment.container.board.course)
|
||||
@course = @attachment.container.board.course
|
||||
elsif !@attachment.container.nil? && ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) && @attachment.container.board &&
|
||||
@attachment.container.board.contest)
|
||||
@contest = @attachment.container.board.contest
|
||||
else
|
||||
unless @attachment.container_type == 'Syllabus' || @attachment.container_type == 'Bid' || @attachment.container_type == 'Organization' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork' || @attachment.container_type == 'Work'|| @attachment.container_type == 'ContestantWork'|| @attachment.container_type == 'Contest' || @attachment.container_type == 'HomeworkBank'
|
||||
@project = @attachment.project
|
||||
|
|
Loading…
Reference in New Issue