fixed 附件下载权限
This commit is contained in:
parent
ea7cf1cd1f
commit
a1731f91a9
|
@ -213,20 +213,17 @@ class AttachmentsController < ApplicationController
|
||||||
def attachment_candown
|
def attachment_candown
|
||||||
unless current_user.admin? || current_user.business?
|
unless current_user.admin? || current_user.business?
|
||||||
candown = true
|
candown = true
|
||||||
unless params[:type] == 'history'
|
if @file.container
|
||||||
if @file.container && current_user.logged?
|
if @file.container.is_a?(Issue)
|
||||||
if @file.container.is_a?(Issue)
|
project = @file.container.project
|
||||||
course = @file.container.project
|
candown = project.is_public || (current_user.logged? && project.member?(current_user))
|
||||||
candown = course.member?(current_user) || course.is_public
|
elsif @file.container.is_a?(Journal)
|
||||||
elsif @file.container.is_a?(Journal)
|
project = @file.container.issue.project
|
||||||
course = @file.container.issue.project
|
candown = project.is_public || (current_user.logged? && project.member?(current_user))
|
||||||
candown = course.member?(current_user) || course.is_public
|
else
|
||||||
else
|
project = nil
|
||||||
course = nil
|
|
||||||
end
|
|
||||||
tip_exception(403, "您没有权限进入") if course.present? && !candown
|
|
||||||
tip_exception(403, "您没有权限进入") if @file.container.is_a?(ApplyUserAuthentication)
|
|
||||||
end
|
end
|
||||||
|
tip_exception(403, "您没有权限进入") if project.present? && !candown
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue