Commit 9f98d10c authored by Ruben Davila's avatar Ruben Davila

Block EE features when the trial period has ended

All the CE features should be still enabled though
parent 9376a5a0
......@@ -158,7 +158,7 @@ class License < ActiveRecord::Base
def block_changes?
return false if current.nil?
return false if License&.current&.trial?
return false if current&.trial?
current.block_changes?
end
......@@ -226,6 +226,8 @@ class License < ActiveRecord::Base
# keep `add_ons`, therefore this method needs to be backward-compatible in that sense.
# See https://gitlab.com/gitlab-org/gitlab-ee/issues/2019
def add_ons
return {} if trial? && expired?
explicit_add_ons = restricted_attr(:add_ons, {})
plan_features = self.class.features_for_plan(plan)
......
......@@ -425,6 +425,15 @@ describe License do
expect(license.add_ons.keys).to include(License::DEPLOY_BOARD_FEATURE, *eep_features)
end
end
context 'with an expired trial license' do
it 'returns an empty Hash' do
License.destroy_all
create(:license, trial: true, expired: true)
expect(License.current.add_ons).to be_empty
end
end
end
describe '#feature_available?' 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