Commit 3036a86c authored by Max Woolf's avatar Max Woolf

Merge branch 'ag-license-route' into 'master'

Check license/subscription route for legacy flow

See merge request gitlab-org/gitlab!61143
parents b46b74b5 4cdb54bf
......@@ -5,6 +5,7 @@ class Admin::LicensesController < Admin::ApplicationController
before_action :license, only: [:show, :download, :destroy]
before_action :require_license, only: [:download, :destroy]
before_action :check_cloud_license, only: [:show]
respond_to :html
......@@ -80,6 +81,10 @@ class Admin::LicensesController < Admin::ApplicationController
@license ||= License.new(data: params[:trial_key])
end
def check_cloud_license
redirect_to admin_cloud_license_path if Gitlab::CurrentSettings.cloud_license_enabled?
end
def license_params
license_params = params.require(:license).permit(:data_file, :data)
license_params.delete(:data) if license_params[:data_file]
......
......@@ -96,6 +96,15 @@ RSpec.describe Admin::LicensesController do
expect(response).to render_template(:show)
end
it 'redirects to new path when a valid license is entered/uploaded' do
allow(License).to receive(:current).and_return(create(:license))
stub_application_setting(cloud_license_enabled: true)
get :show
expect(response).to redirect_to(admin_cloud_license_path)
end
end
context 'without a license' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment