|
|
|
@ -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
|
|
|
|
|
|
|
|
|
|