Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-10-10 01:15:28 +0400
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-10-10 01:15:28 +0400
commit28388d2419c6b5ed5432eca213e2f88af4cee8e9 (patch)
tree2acaf52c7f2bf7a54b774ae10e0cf1bc500c52d1 /app/controllers
parent42343194a524b254bfa10337318e489af914060c (diff)
gitosis error handle
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--app/controllers/errors_controller.rb5
-rw-r--r--app/controllers/projects_controller.rb2
3 files changed, 11 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 09c44502cdf..829126fee05 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -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
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
new file mode 100644
index 00000000000..c37f10a39f3
--- /dev/null
+++ b/app/controllers/errors_controller.rb
@@ -0,0 +1,5 @@
+class ErrorsController < ApplicationController
+ def gitosis
+ render :file => File.join(Rails.root, "public", "gitosis_error"), :layout => false
+ end
+end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 3307ac23d9b..080a6ee62f6 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -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|