File tree 3 files changed +13
-28
lines changed
3 files changed +13
-28
lines changed Original file line number Diff line number Diff line change @@ -64,4 +64,13 @@ def git_author_params
64
64
time : Time . now
65
65
}
66
66
end
67
+
68
+ # checks if the user if the owner of the passed project
69
+ def owner? ( project )
70
+ if id == project . user . id
71
+ true
72
+ else
73
+ false
74
+ end
75
+ end
67
76
end
Original file line number Diff line number Diff line change 1
1
2
2
# This file is used by Rack-based servers to start the application.
3
3
4
- # require './lib/rack/git_http'
5
-
6
4
require ::File . expand_path ( '../config/environment' , __FILE__ )
7
5
run Glitter ::Application
8
-
9
- # map '/health' do
10
- # health = proc do |env|
11
- # [200, { "Content-Type" => "text/html" }, ["1"]]
12
- # end
13
- # run health
14
- # end
15
-
16
-
17
- # map '/git' do
18
- # use Rack::ShowExceptions
19
-
20
- # config = {
21
- # :project_root => "#{ENV["OPENSHIFT_DATA_DIR"]}/repos",
22
- # :git_path => '/usr/bin/git',
23
- # :upload_pack => true,
24
- # :receive_pack => true,
25
- # }
26
-
27
- # run GitHttp::App.new(config)
28
-
29
- # end
Original file line number Diff line number Diff line change @@ -63,17 +63,17 @@ def project_by_path(path)
63
63
def authorized_request?
64
64
case git_cmd
65
65
when *%w{ git-upload-pack git-upload-archive }
66
- unless project . private
66
+ if user
67
+ user . owner? ( project )
68
+ elsif !project . private
67
69
# Allow clone/fetch for public projects
68
70
true
69
71
else
70
72
false
71
73
end
72
74
when *%w{ git-receive-pack }
73
75
if user
74
- # Skip user authorization on upload request.
75
- # It will be done by the pre-receive hook in the repository.
76
- true
76
+ user . owner? ( project )
77
77
else
78
78
false
79
79
end
You can’t perform that action at this time.
0 commit comments