Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4cdb54bf
Commit
4cdb54bf
authored
May 06, 2021
by
Angelo Gulina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check license/subscription route for legacy flow
parent
450a22dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
ee/app/controllers/admin/licenses_controller.rb
ee/app/controllers/admin/licenses_controller.rb
+5
-0
ee/spec/controllers/admin/licenses_controller_spec.rb
ee/spec/controllers/admin/licenses_controller_spec.rb
+9
-0
No files found.
ee/app/controllers/admin/licenses_controller.rb
View file @
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
]
...
...
ee/spec/controllers/admin/licenses_controller_spec.rb
View file @
4cdb54bf
...
...
@@ -91,6 +91,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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment