Commit cc441566 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Disable availability of feature if not permmited on license

parent 61f6b87c
...@@ -6,11 +6,13 @@ class License < ActiveRecord::Base ...@@ -6,11 +6,13 @@ class License < ActiveRecord::Base
GEO_FEATURE = 'GitLab_Geo'.freeze GEO_FEATURE = 'GitLab_Geo'.freeze
AUDITOR_USER_FEATURE = 'GitLab_Auditor_User'.freeze AUDITOR_USER_FEATURE = 'GitLab_Auditor_User'.freeze
SERVICE_DESK_FEATURE = 'GitLab_ServiceDesk'.freeze SERVICE_DESK_FEATURE = 'GitLab_ServiceDesk'.freeze
RELATED_ISSUES_FEATURE = 'RelatedIssues'.freeze
FEATURE_CODES = { FEATURE_CODES = {
geo: GEO_FEATURE, geo: GEO_FEATURE,
auditor_user: AUDITOR_USER_FEATURE, auditor_user: AUDITOR_USER_FEATURE,
service_desk: SERVICE_DESK_FEATURE, service_desk: SERVICE_DESK_FEATURE,
related_issues: RELATED_ISSUES_FEATURE,
# Features that make sense to Namespace: # Features that make sense to Namespace:
deploy_board: DEPLOY_BOARD_FEATURE, deploy_board: DEPLOY_BOARD_FEATURE,
file_lock: FILE_LOCK_FEATURE file_lock: FILE_LOCK_FEATURE
...@@ -22,7 +24,7 @@ class License < ActiveRecord::Base ...@@ -22,7 +24,7 @@ class License < ActiveRecord::Base
EARLY_ADOPTER_PLAN = 'early_adopter'.freeze EARLY_ADOPTER_PLAN = 'early_adopter'.freeze
EES_FEATURES = [ EES_FEATURES = [
# .. { RELATED_ISSUES_FEATURE => 1 },
].freeze ].freeze
EEP_FEATURES = [ EEP_FEATURES = [
......
...@@ -22,6 +22,11 @@ module EE ...@@ -22,6 +22,11 @@ module EE
cannot! :create_note cannot! :create_note
cannot! :read_project cannot! :read_project
end end
unless License.current&.feature_available?(:related_issues)
cannot! :read_issue_link
cannot! :admin_issue_link
end
end end
end end
end end
...@@ -5,6 +5,11 @@ describe Projects::IssueLinksController, type: :controller do ...@@ -5,6 +5,11 @@ describe Projects::IssueLinksController, type: :controller do
let(:project) { create(:project_empty_repo) } let(:project) { create(:project_empty_repo) }
let(:issue) { create :issue, project: project } let(:issue) { create :issue, project: project }
before do
allow_any_instance_of(License).to receive(:feature_available?) { false }
allow_any_instance_of(License).to receive(:feature_available?).with(:related_issues) { true }
end
describe 'GET #index' do describe 'GET #index' do
let(:service) { double(IssueLinks::ListService, execute: service_response) } let(:service) { double(IssueLinks::ListService, execute: service_response) }
let(:service_response) { [{ 'foo' => 'bar' }] } let(:service_response) { [{ 'foo' => 'bar' }] }
......
...@@ -11,6 +11,9 @@ describe IssueLinks::CreateService, service: true do ...@@ -11,6 +11,9 @@ describe IssueLinks::CreateService, service: true do
end end
before do before do
allow_any_instance_of(License).to receive(:feature_available?) { false }
allow_any_instance_of(License).to receive(:feature_available?).with(:related_issues) { true }
project.team << [user, :developer] project.team << [user, :developer]
end end
......
...@@ -7,6 +7,9 @@ describe IssueLinks::ListService, service: true do ...@@ -7,6 +7,9 @@ describe IssueLinks::ListService, service: true do
let(:user_role) { :developer } let(:user_role) { :developer }
before do before do
allow_any_instance_of(License).to receive(:feature_available?) { false }
allow_any_instance_of(License).to receive(:feature_available?).with(:related_issues) { true }
project.team << [user, user_role] project.team << [user, user_role]
end end
......
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