私有资源不能下载

This commit is contained in:
huang 2016-05-20 17:04:20 +08:00
parent f9e445500e
commit 18054dd96d
2 changed files with 7 additions and 3 deletions

View File

@ -2705,7 +2705,7 @@ class UsersController < ApplicationController
# 获取公共资源搜索
def get_public_resources_search user_course_ids, user_project_ids, order, score, search
attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)" ,:p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的资源
@ -2816,7 +2816,7 @@ class UsersController < ApplicationController
# 获取我的用户类型资源
def get_principal_resources_public order, score
attchments = Attachment.where("container_type = 'Principal'and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}")
attchments = Attachment.where("container_type = 'Principal' and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源

View File

@ -14,7 +14,11 @@
<!--<input name="checkbox2" type="checkbox" value="" class="resourcesCheckbox" />-->
</li>
<li class="resource-list-name fl">
<%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack resource-list-middle hidden mw280' %>
<% if attach.is_public == 0 && attach.get_apply_resource_status(attach.id, attach.author_id) != 2 %>
<a href="" style="cursor: default" class = "resourcesBlack resource-list-middle hidden mw280" title="<%= attach.filename %>"><%= attach.filename %> </a>
<% else %>
<%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack resource-list-middle hidden mw280' %>
<% end %>
<% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current %>
<img src="/images/locked.png" alt="私有" title="私有" class="resource-list-middle" height="16" width="16">
<% end %>