diff options
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/application_controller.rb | 4 | ||||
| -rw-r--r-- | app/controllers/errors_controller.rb | 5 | ||||
| -rw-r--r-- | app/controllers/projects_controller.rb | 2 |
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| |
