版本库私有权限设置

--项目成员可以查看
--左侧入口隐藏
--禁止通过url访问
This commit is contained in:
huang 2015-05-13 11:46:19 +08:00
parent 68050b7d22
commit 406d608edc
2 changed files with 10 additions and 9 deletions

View File

@ -244,12 +244,12 @@ update
def show
## TODO: the below will move to filter, done.
# if !User.current.member_of?(@project)
# if @project.hidden_repo
# render_403
# return -1
# end
# end
if !User.current.member_of?(@project)
if @project.hidden_repo
render_403
return -1
end
end
#if( !User.current.member_of?(@project) || @project.hidden_repo)
@repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?

View File

@ -37,13 +37,14 @@
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
<% end %>
</div>
<% end%>
<% unless @project.enabled_modules.where("name = 'repository'").empty? || @project.repositories.count == 0 %>
<% end %>
<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %>
<% unless @project.hidden_repo || @project.enabled_modules.where("name = 'repository'").empty? || @project.repositories.count == 0 %>
<div class="subNav">
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
</div>
<% end %><!--meny end -->
<% end %><!--meny end -->
<!-- more -->
<div class="subNav subNav_jiantou" onclick="$('#navContent').toggle(500);" id="expand_tools_expand"><%= l(:label_project_more) %></div>