Fix access to pages domain settings

This commit is contained in:
Vladimir Shushlin 2019-02-12 12:18:17 +00:00 committed by Grzegorz Bizon
parent a68ff6d61d
commit 13d2d1985c
3 changed files with 22 additions and 2 deletions

View File

@ -4,7 +4,7 @@ class Projects::PagesDomainsController < Projects::ApplicationController
layout 'project_settings'
before_action :require_pages_enabled!
before_action :authorize_update_pages!, except: [:show]
before_action :authorize_update_pages!
before_action :domain, except: [:new, :create]
def show

View File

@ -0,0 +1,5 @@
---
title: Require maintainer access to show pages domain settings
merge_request: 24926
author:
type: fixed

View File

@ -23,12 +23,27 @@ describe Projects::PagesDomainsController do
end
describe 'GET show' do
it "displays the 'show' page" do
def make_request
get(:show, params: request_params.merge(id: pages_domain.domain))
end
it "displays the 'show' page" do
make_request
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template('show')
end
context 'when user is developer' do
before do
project.add_developer(user)
end
it 'renders 404 page' do
make_request
expect(response).to have_gitlab_http_status(404)
end
end
end
describe 'GET new' do