Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
ec9e54ea
Commit
ec9e54ea
authored
Oct 10, 2011
by
gitlabhq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gitosis error handle
parent
d7ea9052
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
8 deletions
+50
-8
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+4
-0
app/controllers/errors_controller.rb
app/controllers/errors_controller.rb
+5
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+2
-0
config/application.rb
config/application.rb
+1
-1
config/routes.rb
config/routes.rb
+1
-0
lib/gitosis.rb
lib/gitosis.rb
+11
-7
public/gitosis_error.html
public/gitosis_error.html
+26
-0
No files found.
app/controllers/application_controller.rb
View file @
ec9e54ea
...
...
@@ -4,6 +4,10 @@ class ApplicationController < ActionController::Base
helper_method
:abilities
,
:can?
rescue_from
Gitosis
::
AccessDenied
do
|
exception
|
render
:file
=>
File
.
join
(
Rails
.
root
,
"public"
,
"gitosis_error"
),
:layout
=>
false
end
protected
def
abilities
...
...
app/controllers/errors_controller.rb
0 → 100644
View file @
ec9e54ea
class
ErrorsController
<
ApplicationController
def
gitosis
render
:file
=>
File
.
join
(
Rails
.
root
,
"public"
,
"gitosis_error"
),
:layout
=>
false
end
end
app/controllers/projects_controller.rb
View file @
ec9e54ea
...
...
@@ -105,6 +105,8 @@ class ProjectsController < ApplicationController
format
.
json
{
render
json:
@project
.
errors
,
status: :unprocessable_entity
}
end
end
rescue
Gitosis
::
AccessDenied
render
:js
=>
"location.href = '
#{
errors_gitosis_path
}
'"
and
return
rescue
StandardError
=>
ex
@project
.
errors
.
add
(
:base
,
"Cant save project. Please try again later"
)
respond_to
do
|
format
|
...
...
config/application.rb
View file @
ec9e54ea
...
...
@@ -16,7 +16,7 @@ module Gitlab
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras
)
config
.
autoload_paths
+=
%W(
#{
config
.
root
}
/lib
)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
...
...
config/routes.rb
View file @
ec9e54ea
...
...
@@ -10,6 +10,7 @@ Gitlab::Application.routes.draw do
root
:to
=>
"users#index"
end
get
"errors/gitosis"
get
"profile/password"
,
:to
=>
"profile#password"
put
"profile/password"
,
:to
=>
"profile#password_update"
get
"profile"
,
:to
=>
"profile#show"
...
...
lib/gitosis.rb
View file @
ec9e54ea
require
'inifile'
require
'timeout'
class
Gitosis
class
AccessDenied
<
StandardError
;
end
def
pull
# create tmp dir
...
...
@@ -20,15 +21,19 @@ class Gitosis
end
def
configure
File
.
open
(
File
.
join
(
Dir
.
tmpdir
,
"gitme-gitosis.lock"
),
"w+"
)
do
|
f
|
status
=
Timeout
::
timeout
(
5
)
{
File
.
open
(
File
.
join
(
Dir
.
tmpdir
,
"gitme-gitosis.lock"
),
"w+"
)
do
|
f
|
f
.
flock
(
File
::
LOCK_EX
)
pull
yield
(
self
)
push
f
.
flock
(
File
::
LOCK_UN
)
end
end
}
rescue
Exception
=>
ex
raise
Gitosis
::
AccessDenied
.
new
(
"gitosis timeout"
)
end
def
destroy_project
(
project
)
...
...
@@ -51,7 +56,7 @@ class Gitosis
`cd
#{
File
.
join
(
@local_dir
,
'gitosis'
)
}
; git rm keydir/
#{
user
}
.pub`
end
#update or create
#update or create
def
update_project
(
repo_name
,
name_writers
)
# write config file
conf
=
IniFile
.
new
(
File
.
join
(
@local_dir
,
'gitosis'
,
'gitosis.conf'
))
...
...
@@ -61,5 +66,4 @@ class Gitosis
conf
.
write
end
end
public/gitosis_error.html
0 → 100644
View file @
ec9e54ea
<!DOCTYPE html>
<html>
<head>
<title>
We're sorry, but we cant get access to your gitosis
</title>
<style
type=
"text/css"
>
body
{
background-color
:
#EAEAEA
;
color
:
#666
;
text-align
:
center
;
font-family
:
arial
,
sans-serif
;
}
div
.dialog
{
width
:
600px
;
padding
:
0
4em
;
margin
:
4em
auto
0
auto
;
}
h1
{
font-size
:
48px
;
color
:
#444
;
line-height
:
1.5em
;
}
h2
{
font-size
:
24px
;
color
:
#666
;
line-height
:
1.5em
;
}
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div
class=
"dialog"
>
<h1>
Gitosis Error
</h1>
<h2>
We're sorry, but we cant get access to your gitosis.
</h2>
<h3>
1. Check 'config/gitosis.yml' for correct settings.
</h3>
<h3>
2. Be sure web server user has access to gitosis.
</h3>
</div>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment