Commit 871f3e30 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch '212375-seat-link-admin-toggle' into 'master'

Resolve "Allow Seat Link to be disabled through admin toggle"

Closes #212375

See merge request gitlab-org/gitlab!28015
parents 833157a3 8d63638f
...@@ -60,4 +60,6 @@ ...@@ -60,4 +60,6 @@
.settings-content .settings-content
= render 'usage' = render 'usage'
= render_if_exists 'admin/application_settings/seat_link_setting', expanded: expanded_by_default?
= render_if_exists 'admin/application_settings/pseudonymizer_settings', expanded: expanded_by_default? = render_if_exists 'admin/application_settings/pseudonymizer_settings', expanded: expanded_by_default?
...@@ -210,6 +210,7 @@ Gitlab.ee do ...@@ -210,6 +210,7 @@ Gitlab.ee do
Settings.gitlab['mirror_max_delay'] ||= 300 Settings.gitlab['mirror_max_delay'] ||= 300
Settings.gitlab['mirror_max_capacity'] ||= 30 Settings.gitlab['mirror_max_capacity'] ||= 30
Settings.gitlab['mirror_capacity_threshold'] ||= 15 Settings.gitlab['mirror_capacity_threshold'] ||= 15
Settings.gitlab['seat_link_enabled'] = true if Settings.gitlab['seat_link_enabled'].nil?
end end
# #
......
# frozen_string_literal: true
class AddSeatLinkEnabledToApplicationSettings < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_column_with_default(:application_settings, :seat_link_enabled,
:boolean,
default: true,
allow_null: false)
end
def down
remove_column(:application_settings, :seat_link_enabled)
end
end
...@@ -396,7 +396,8 @@ CREATE TABLE public.application_settings ( ...@@ -396,7 +396,8 @@ CREATE TABLE public.application_settings (
email_restrictions_enabled boolean DEFAULT false NOT NULL, email_restrictions_enabled boolean DEFAULT false NOT NULL,
email_restrictions text, email_restrictions text,
npm_package_requests_forwarding boolean DEFAULT true NOT NULL, npm_package_requests_forwarding boolean DEFAULT true NOT NULL,
namespace_storage_size_limit bigint DEFAULT 0 NOT NULL namespace_storage_size_limit bigint DEFAULT 0 NOT NULL,
seat_link_enabled boolean DEFAULT true NOT NULL
); );
CREATE SEQUENCE public.application_settings_id_seq CREATE SEQUENCE public.application_settings_id_seq
...@@ -12847,6 +12848,7 @@ COPY "schema_migrations" (version) FROM STDIN; ...@@ -12847,6 +12848,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200323122201 20200323122201
20200323134519 20200323134519
20200324115359 20200324115359
20200325152327
20200325160952 20200325160952
20200325183636 20200325183636
\. \.
......
...@@ -245,11 +245,12 @@ Seat Link allows us to provide our self-managed customers with prorated charges ...@@ -245,11 +245,12 @@ Seat Link allows us to provide our self-managed customers with prorated charges
Seat Link sends to GitLab daily a count of all users in connected self-managed instances. That information is used to automate prorated reconciliations. The data is sent securely through an encrypted HTTPS connection. Seat Link sends to GitLab daily a count of all users in connected self-managed instances. That information is used to automate prorated reconciliations. The data is sent securely through an encrypted HTTPS connection.
Seat Link is mandatory because we need the user count data to enable prorated billing. Seat Link provides **only** the following information to GitLab: Seat Link provides **only** the following information to GitLab:
- Date - Date
- License key - License key
- Historical maximum user count - Historical maximum user count
- Active users count
For air-gapped or closed network customers, the existing [true-up model](#users-over-license) will be used. Prorated charges are not possible without user count data. For air-gapped or closed network customers, the existing [true-up model](#users-over-license) will be used. Prorated charges are not possible without user count data.
...@@ -293,12 +294,39 @@ TjJ4eVlVUkdkWEJtDQpkSHByYWpreVJrcG9UVlo0Y0hKSU9URndiV2RzVFdO ...@@ -293,12 +294,39 @@ TjJ4eVlVUkdkWEJtDQpkSHByYWpreVJrcG9UVlo0Y0hKSU9URndiV2RzVFdO
VlhHNXRhVmszTkV0SVEzcEpNMWRyZEVoRU4ydHINCmRIRnFRVTlCVUVVM1pV VlhHNXRhVmszTkV0SVEzcEpNMWRyZEVoRU4ydHINCmRIRnFRVTlCVUVVM1pV
SlRORE4xUjFaYVJGb3JlWGM5UFZ4dUlpd2lhWFlpt2lKV00yRnNVbk5RTjJk SlRORE4xUjFaYVJGb3JlWGM5UFZ4dUlpd2lhWFlpt2lKV00yRnNVbk5RTjJk
Sg0KU1hNMGExaE9SVGR2V2pKQlBUMWNiaUo5DQo=', Sg0KU1hNMGExaE9SVGR2V2pKQlBUMWNiaUo5DQo=',
max_historical_user_count: 10 max_historical_user_count: 10,
active_users: 6
} }
</code></pre> </code></pre>
</details> </details>
#### Disable Seat Link
Seat Link is enabled by default. To disable this feature, go to
**{admin}** **Admin Area > Settings > Metrics and profiling** and
clear the Seat Link checkbox.
To disable Seat Link in an Omnibus GitLab installation, and prevent it from
being configured in the future through the administration panel, set the following in
[`gitlab.rb`](https://docs.gitlab.com/omnibus/settings/configuration.html#configuration-options):
```ruby
gitlab_rails['seat_link_enabled'] = false
```
To disable Seat Link in a GitLab source installation, and prevent it from
being configured in the future through the administration panel,
set the following in `gitlab.yml`:
```yaml
production: &base
# ...
gitlab:
# ...
seat_link_enabled: false
```
### Renew or change a GitLab.com subscription ### Renew or change a GitLab.com subscription
To renew for more users than are currently active in your GitLab.com system, contact our sales team via `renewals@gitlab.com` for assistance as this can't be done in the Customers Portal. To renew for more users than are currently active in your GitLab.com system, contact our sales team via `renewals@gitlab.com` for assistance as this can't be done in the Customers Portal.
......
...@@ -43,6 +43,7 @@ module EE ...@@ -43,6 +43,7 @@ module EE
:max_personal_access_token_lifetime, :max_personal_access_token_lifetime,
:pseudonymizer_enabled, :pseudonymizer_enabled,
:repository_size_limit, :repository_size_limit,
:seat_link_enabled,
:shared_runners_minutes, :shared_runners_minutes,
:slack_app_enabled, :slack_app_enabled,
:slack_app_id, :slack_app_id,
......
...@@ -115,7 +115,8 @@ module EE ...@@ -115,7 +115,8 @@ module EE
slack_app_secret: nil, slack_app_secret: nil,
slack_app_verification_token: nil, slack_app_verification_token: nil,
custom_project_templates_group_id: nil, custom_project_templates_group_id: nil,
geo_node_allowed_ips: '0.0.0.0/0, ::/0' geo_node_allowed_ips: '0.0.0.0/0, ::/0',
seat_link_enabled: Settings.gitlab['seat_link_enabled']
) )
end end
end end
...@@ -158,6 +159,18 @@ module EE ...@@ -158,6 +159,18 @@ module EE
pseudonymizer_available? && super pseudonymizer_available? && super
end end
def seat_link_available?
License.feature_available?(:seat_link)
end
def seat_link_can_be_configured?
Settings.gitlab.seat_link_enabled
end
def seat_link_enabled?
seat_link_available? && seat_link_can_be_configured? && super
end
def should_check_namespace_plan? def should_check_namespace_plan?
check_namespace_plan? && (Rails.env.test? || ::Gitlab.dev_env_org_or_com?) check_namespace_plan? && (Rails.env.test? || ::Gitlab.dev_env_org_or_com?)
end end
......
...@@ -36,6 +36,7 @@ class License < ApplicationRecord ...@@ -36,6 +36,7 @@ class License < ApplicationRecord
related_issues related_issues
repository_mirrors repository_mirrors
repository_size_limit repository_size_limit
seat_link
scoped_issue_board scoped_issue_board
usage_quotas usage_quotas
visual_review_app visual_review_app
...@@ -216,6 +217,7 @@ class License < ApplicationRecord ...@@ -216,6 +217,7 @@ class License < ApplicationRecord
project_aliases project_aliases
repository_size_limit repository_size_limit
required_ci_templates required_ci_templates
seat_link
usage_quotas usage_quotas
].freeze ].freeze
......
= form_for @application_setting, url: metrics_and_profiling_admin_application_settings_path(anchor: 'js-seat-link-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
.form-group
- can_be_configured = @application_setting.seat_link_can_be_configured?
.form-check
= f.check_box :seat_link_enabled, disabled: !can_be_configured, class: 'form-check-input'
= f.label :seat_link_enabled, class: 'form-check-label' do
= _('Enable Seat Link')
.form-text.text-muted
- if can_be_configured
%p.mb-2= _('To simplify the billing process, GitLab will collect user counts in order to prorate charges for user growth throughout the year using a quarterly reconciliation process.')
- link_path = help_page_path('subscriptions/index', anchor: 'seat-link')
- link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: link_path }
%p.mb-2= s_('%{link_start}Learn more%{link_end} about what information is shared with GitLab Inc.').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
- else
= _('Seat Link is disabled, and cannot be configured through this form.')
- link_path = help_page_path('subscriptions/index', anchor: 'disable-seat-link')
- link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: link_path }
= s_('For more information, see the documentation on %{link_start}disabling Seat Link%{link_end}.').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
= f.submit 'Save changes', class: "btn btn-success"
- return unless Gitlab::CurrentSettings.seat_link_available?
%section.settings.as-seat-link.no-animate#js-seat-link-settings{ class: ('expanded' if expanded) }
.settings-header
%h4
= _('Seat Link')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
= expanded_by_default? ? _('Collapse') : _('Expand')
%p
= _('Enable or disable Seat Link.')
.settings-content
= render 'seat_link_form'
...@@ -26,10 +26,12 @@ class SyncSeatLinkWorker # rubocop:disable Scalability/IdempotentWorker ...@@ -26,10 +26,12 @@ class SyncSeatLinkWorker # rubocop:disable Scalability/IdempotentWorker
private private
# Only sync paid licenses from start date until 14 days after expiration # Only sync paid licenses from start date until 14 days after expiration
# when seat link feature is enabled.
def should_sync_seats? def should_sync_seats?
License.current && Gitlab::CurrentSettings.seat_link_enabled? &&
!License.current.trial? && License.current &&
report_date.between?(License.current.starts_at, License.current.expires_at + 14.days) !License.current.trial? &&
report_date.between?(License.current.starts_at, License.current.expires_at + 14.days)
end end
def max_historical_user_count def max_historical_user_count
......
---
title: Allow Seat Link to be disabled through configuration or admin toggle
merge_request: 28015
author:
type: fixed
...@@ -508,4 +508,69 @@ describe ApplicationSetting do ...@@ -508,4 +508,69 @@ describe ApplicationSetting do
end end
end end
end end
describe '#seat_link_available?' do
subject { setting.seat_link_available? }
before do
allow(License).to receive(:feature_available?).and_call_original
allow(License).to receive(:feature_available?).with(:seat_link).and_return(seat_link)
end
context 'when the seat_link feature is available' do
let(:seat_link) { true }
it { is_expected.to eq(true) }
end
context 'when the seat_link feature is not available' do
let(:seat_link) { false }
it { is_expected.to eq(false) }
end
end
describe '#seat_link_can_be_configured?' do
subject { setting.seat_link_can_be_configured? }
before do
allow(Settings.gitlab).to receive(:seat_link_enabled).and_return(seat_link_enabled)
end
context 'when the seat_link_enabled configuration is enabled' do
let(:seat_link_enabled) { true }
it { is_expected.to eq(true) }
end
context 'when the seat_link_enabled configuration is disabled' do
let(:seat_link_enabled) { false }
it { is_expected.to eq(false) }
end
end
describe '#seat_link_enabled?' do
subject { setting.seat_link_enabled? }
using RSpec::Parameterized::TableSyntax
where(:seat_link_available, :seat_link_can_be_configured, :seat_link_enabled, :result) do
true | true | true | true
false | true | true | false
true | false | true | false
true | true | false | false
false | false | false | false
end
with_them do
before do
allow(setting).to receive(:seat_link_available?).and_return(seat_link_available)
allow(setting).to receive(:seat_link_can_be_configured?).and_return(seat_link_can_be_configured)
setting.seat_link_enabled = seat_link_enabled
end
it { is_expected.to eq(result) }
end
end
end end
...@@ -132,5 +132,13 @@ describe SyncSeatLinkWorker, type: :worker do ...@@ -132,5 +132,13 @@ describe SyncSeatLinkWorker, type: :worker do
end end
end end
end end
context 'when seat link has been disabled' do
before do
allow(Gitlab::CurrentSettings).to receive(:seat_link_enabled?).and_return(false)
end
include_examples 'no seat link sync'
end
end end
end end
...@@ -339,6 +339,9 @@ msgstr "" ...@@ -339,6 +339,9 @@ msgstr ""
msgid "%{lineOneStart}Drag and drop to upload your designs%{lineOneEnd} or %{linkStart}click to upload%{linkEnd}." msgid "%{lineOneStart}Drag and drop to upload your designs%{lineOneEnd} or %{linkStart}click to upload%{linkEnd}."
msgstr "" msgstr ""
msgid "%{link_start}Learn more%{link_end} about what information is shared with GitLab Inc."
msgstr ""
msgid "%{link_start}Read more%{link_end} about role permissions" msgid "%{link_start}Read more%{link_end} about role permissions"
msgstr "" msgstr ""
...@@ -7458,6 +7461,9 @@ msgstr "" ...@@ -7458,6 +7461,9 @@ msgstr ""
msgid "Enable SAML authentication for this group" msgid "Enable SAML authentication for this group"
msgstr "" msgstr ""
msgid "Enable Seat Link"
msgstr ""
msgid "Enable access to Grafana" msgid "Enable access to Grafana"
msgstr "" msgstr ""
...@@ -7500,6 +7506,9 @@ msgstr "" ...@@ -7500,6 +7506,9 @@ msgstr ""
msgid "Enable mirror configuration" msgid "Enable mirror configuration"
msgstr "" msgstr ""
msgid "Enable or disable Seat Link."
msgstr ""
msgid "Enable or disable keyboard shortcuts" msgid "Enable or disable keyboard shortcuts"
msgstr "" msgstr ""
...@@ -9012,6 +9021,9 @@ msgstr "" ...@@ -9012,6 +9021,9 @@ msgstr ""
msgid "For more information, see the documentation on %{deactivating_usage_ping_link_start}deactivating the usage ping%{deactivating_usage_ping_link_end}." msgid "For more information, see the documentation on %{deactivating_usage_ping_link_start}deactivating the usage ping%{deactivating_usage_ping_link_end}."
msgstr "" msgstr ""
msgid "For more information, see the documentation on %{link_start}disabling Seat Link%{link_end}."
msgstr ""
msgid "For private projects, any member (guest or higher) can view pipelines and access job details (output logs and artifacts)" msgid "For private projects, any member (guest or higher) can view pipelines and access job details (output logs and artifacts)"
msgstr "" msgstr ""
...@@ -17543,6 +17555,12 @@ msgid_plural "SearchResults|wiki results" ...@@ -17543,6 +17555,12 @@ msgid_plural "SearchResults|wiki results"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
msgid "Seat Link"
msgstr ""
msgid "Seat Link is disabled, and cannot be configured through this form."
msgstr ""
msgid "Seats currently in use" msgid "Seats currently in use"
msgstr "" msgstr ""
...@@ -21101,6 +21119,9 @@ msgstr "" ...@@ -21101,6 +21119,9 @@ msgstr ""
msgid "To set up this service:" msgid "To set up this service:"
msgstr "" msgstr ""
msgid "To simplify the billing process, GitLab will collect user counts in order to prorate charges for user growth throughout the year using a quarterly reconciliation process."
msgstr ""
msgid "To specify the notification level per project of a group you belong to, you need to visit project page and change notification level there." msgid "To specify the notification level per project of a group you belong to, you need to visit project page and change notification level there."
msgstr "" msgstr ""
......
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