summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab <example@example.com>2015-02-12 18:05:36 -0500
committerGitLab <example@example.com>2015-02-12 18:05:36 -0500
commit849d8fdc7f0397f77766ff7a66175553d74c72ef (patch)
treefb5a7e63307ae12269ff8ef634009391a8beba5b /lib
parent60ea57702fcdf2c919ab8b3aa6fb7f4f69fdfb7b (diff)
downloadgitlab-shell-849d8fdc7f0397f77766ff7a66175553d74c72ef.tar.gz
Enable git-annex validate access
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab_projects.rb5
-rw-r--r--lib/gitlab_shell.rb11
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index 05ee211..59a9347 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -238,4 +238,9 @@ class GitlabProjects
$logger.info "Update head in project #{project_name} to <#{new_head}>."
true
end
+
+ def git_init_annex
+ cmd = %W(git --git-dir=#{full_path} annex init "GitLab")
+ system(*cmd)
+ end
end
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index 992adc7..a8494bf 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -20,12 +20,11 @@ class GitlabShell
if git_cmds.include?(@git_cmd)
ENV['GL_ID'] = @key_id
- ENV['HOME'] ='/var/opt/gitlab'
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# TODO: Fix validation for git-annex-shell !!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- if true #validate_access
+ if validate_access
process_cmd
else
message = "gitlab-shell: Access denied for git command <#{@origin_cmd}> by #{log_username}."
@@ -60,7 +59,7 @@ class GitlabShell
@git_cmd = args.first
if @git_cmd == 'git-annex-shell'
- @repo_name = escape_path(args[2].gsub("\/~\/", ''))
+ @repo_name = escape_path(args[2].gsub("\/~\/", ''))
else
@repo_name = escape_path(args.last)
end
@@ -73,10 +72,10 @@ class GitlabShell
def process_cmd
repo_full_path = File.join(repos_path, repo_name)
$logger.info "gitlab-shell: executing git command <#{@git_cmd} #{repo_full_path}> for #{log_username}."
-
+
if @git_cmd == 'git-annex-shell'
args = Shellwords.shellwords(@origin_cmd)
- parsed_args =
+ parsed_args =
args.map do |arg|
if arg =~ /\A\/~\/.*\.git\Z/
repo_full_path
@@ -86,7 +85,7 @@ class GitlabShell
end
exec_cmd(*parsed_args)
- else
+ else
exec_cmd(@git_cmd, repo_full_path)
end
end