diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-02-03 11:24:14 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-02-03 11:24:14 +0100 |
commit | 8670411ae7acb93b5113634a3ae5e476ef6d2aee (patch) | |
tree | ff1437549231ff2d3427c92eca3e42c521acee55 /app/controllers/ci | |
parent | 627909c2a4a938c6387afa459ef4dc815fe9fb5a (diff) | |
download | gitlab-ce-8670411ae7acb93b5113634a3ae5e476ef6d2aee.tar.gz |
Clean Ci::ApplicationController from unused permission related code
Diffstat (limited to 'app/controllers/ci')
-rw-r--r-- | app/controllers/ci/application_controller.rb | 47 | ||||
-rw-r--r-- | app/controllers/ci/projects_controller.rb | 5 |
2 files changed, 2 insertions, 50 deletions
diff --git a/app/controllers/ci/application_controller.rb b/app/controllers/ci/application_controller.rb index 59c77653509..5bb7d499cdc 100644 --- a/app/controllers/ci/application_controller.rb +++ b/app/controllers/ci/application_controller.rb @@ -3,52 +3,5 @@ module Ci def self.railtie_helpers_paths "app/helpers/ci" end - - private - - def authorize_access_project! - unless can?(current_user, :read_project, project) - return page_404 - end - end - - def authorize_manage_builds! - unless can?(current_user, :update_build, project) - return page_404 - end - end - - def authenticate_admin! - return render_404 unless current_user.is_admin? - end - - def authorize_manage_project! - unless can?(current_user, :admin_project, project) - return page_404 - end - end - - def page_404 - render file: "#{Rails.root}/public/404.html", status: 404, layout: false - end - - def default_headers - headers['X-Frame-Options'] = 'DENY' - headers['X-XSS-Protection'] = '1; mode=block' - end - - # JSON for infinite scroll via Pager object - def pager_json(partial, count) - html = render_to_string( - partial, - layout: false, - formats: [:html] - ) - - render json: { - html: html, - count: count - } - end end end diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb index 3004c2d27f0..711c2847d5e 100644 --- a/app/controllers/ci/projects_controller.rb +++ b/app/controllers/ci/projects_controller.rb @@ -1,8 +1,7 @@ module Ci class ProjectsController < Ci::ApplicationController - before_action :project, except: [:index] - before_action :authenticate_user!, except: [:index, :build, :badge] - before_action :authorize_access_project!, except: [:index, :badge] + before_action :project + before_action :authorize_read_project!, except: [:badge] before_action :no_cache, only: [:badge] protect_from_forgery |