添加权限

dev_shcool
huang 9 years ago
parent 2f8079e85c
commit 88f8752490

@ -39,6 +39,8 @@ class RepositoriesController < ApplicationController
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analysis]
# 链接gitlab
before_filter :connect_gitlab, :only => [:quality_analysis, :show]
# 版本库新增权限
before_filter :show_rep, :only => [:show]
accept_rss_auth :revisions
# hidden repositories filter // 隐藏代码过滤器
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
@ -361,10 +363,7 @@ update
def show
## TODO: the below will move to filter, done.
if !User.current.member_of?(@project) && @project.hidden_repo
render_403
return
end
# 获取版本库目录结构
@entries = @repository.entries(@path, @rev)
if request.xhr?
@ -654,9 +653,20 @@ update
# 链接gitlab
def connect_gitlab
@g = Gitlab.client
unless @project.gpid.nil?
@g_project = @g.project(@project.gpid)
begin
@g = Gitlab.client
unless @project.gpid.nil?
@g_project = @g.project(@project.gpid)
end
rescue => e
logger.error("failed to connect gitlab ==> #{e}")
end
end
def show_rep
if !User.current.member_of?(@project) && @project.hidden_repo
render_403
return
end
end

@ -9,7 +9,7 @@
<tr id="<%= tr_id %>" class="<%= h params[:parent_id] %> entry <%= entry.kind %>">
<td style="padding-left: <%=18 * depth%>px;" class="filename_no_report hidden">
<% if entry.is_dir? %>
<%# 展开文件目录 %>
<%# 展开文件目录 %>
<span class="expander" onclick="scmEntryClick('<%= tr_id %>', '<%= escape_javascript(url_for(
:action => 'show',
:id => @project,
@ -20,17 +20,10 @@
:depth => (depth + 1),
:parent_id => tr_id)) %>');">&nbsp;</span>
<% end %>
<!--<a class="<%#= (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}") %>">-->
<!--<%#= h(ent_name) %>-->
<!--</a>-->
<%#= h(ent_name), :class => "(entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
<%= link_to h(ent_name),
{:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
:class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
<%= link_to h(ent_name),
{:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
:class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
</td>
<!--<td class="size"><%#= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>-->
<!--<td class="size"><%#= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>-->
<%# if @repository.report_last_commit %>
<div id="children_tree">
<td class="tree-comments c_grey hidden">
<div class="hidden" title="<%= (latest_changes.message) if latest_changes && latest_changes.message %>">
@ -46,10 +39,8 @@
<div class="hidden" title="<%= format_time(latest_changes.time) %>">
<%# 为了转换UTC时间时差8小时 %>
<%= distance_of_time_in_words(latest_changes.time, Time.now + 8.hours) if latest_changes && latest_changes.time %>
<%#= latest_changes.time if latest_changes && latest_changes.time %>
</div>
</td>
</div>
<%# end %>
</tr>
<% end %>

@ -65,19 +65,9 @@
</div>
<% end %>
<!--contextual end-->
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
<%# 数据统计 %>
<%#= render :partial => 'summary' %>
<%# end %>
<%#= render :partial => 'dir_list' %>
<%= render :partial => 'dir_list' %>
<% end %>
<%#= render_properties(@properties) %>
<!-- 代码修订 -->
<%#= render_properties(@properties) %>
<a href="https://<%=Setting.host_name %>/forums/1/memos/1232" >如何提交代码</a>
</div>

Loading…
Cancel
Save