Commit 8d63638f authored by Tyler Amos's avatar Tyler Amos

Admin toggle for enabling Seat Link

- Add seat_link_enabled to application_settings table.
- Add seat link toggle to Metrics and Profiling Admin page.
- Default seat_link_enabled setting to true.
- Adjust the Subscriptions doc page:
  - Add active users to payload information.
  - Details on how to deactivate Seat Link.
  - Remove sentence about Seat Link being mandatory.
parent c152e2e4
......@@ -60,4 +60,6 @@
.settings-content
= 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?
......@@ -210,6 +210,7 @@ Gitlab.ee do
Settings.gitlab['mirror_max_delay'] ||= 300
Settings.gitlab['mirror_max_capacity'] ||= 30
Settings.gitlab['mirror_capacity_threshold'] ||= 15
Settings.gitlab['seat_link_enabled'] = true if Settings.gitlab['seat_link_enabled'].nil?
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 (
email_restrictions_enabled boolean DEFAULT false NOT NULL,
email_restrictions text,
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
......@@ -12847,6 +12848,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200323122201
20200323134519
20200324115359
20200325152327
20200325160952
20200325183636
\.
......
......@@ -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 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
- License key
- 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.
......@@ -293,12 +294,39 @@ TjJ4eVlVUkdkWEJtDQpkSHByYWpreVJrcG9UVlo0Y0hKSU9URndiV2RzVFdO
VlhHNXRhVmszTkV0SVEzcEpNMWRyZEVoRU4ydHINCmRIRnFRVTlCVUVVM1pV
SlRORE4xUjFaYVJGb3JlWGM5UFZ4dUlpd2lhWFlpt2lKV00yRnNVbk5RTjJk
Sg0KU1hNMGExaE9SVGR2V2pKQlBUMWNiaUo5DQo=',
max_historical_user_count: 10
max_historical_user_count: 10,
active_users: 6
}
</code></pre>
</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
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
:max_personal_access_token_lifetime,
:pseudonymizer_enabled,
:repository_size_limit,
:seat_link_enabled,
:shared_runners_minutes,
:slack_app_enabled,
:slack_app_id,
......
......@@ -115,7 +115,8 @@ module EE
slack_app_secret: nil,
slack_app_verification_token: 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
......@@ -158,6 +159,18 @@ module EE
pseudonymizer_available? && super
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?
check_namespace_plan? && (Rails.env.test? || ::Gitlab.dev_env_org_or_com?)
end
......
......@@ -36,6 +36,7 @@ class License < ApplicationRecord
related_issues
repository_mirrors
repository_size_limit
seat_link
scoped_issue_board
usage_quotas
visual_review_app
......@@ -216,6 +217,7 @@ class License < ApplicationRecord
project_aliases
repository_size_limit
required_ci_templates
seat_link
usage_quotas
].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
private
# Only sync paid licenses from start date until 14 days after expiration
# when seat link feature is enabled.
def should_sync_seats?
License.current &&
!License.current.trial? &&
report_date.between?(License.current.starts_at, License.current.expires_at + 14.days)
Gitlab::CurrentSettings.seat_link_enabled? &&
License.current &&
!License.current.trial? &&
report_date.between?(License.current.starts_at, License.current.expires_at + 14.days)
end
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
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
......@@ -132,5 +132,13 @@ describe SyncSeatLinkWorker, type: :worker do
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
......@@ -339,6 +339,9 @@ msgstr ""
msgid "%{lineOneStart}Drag and drop to upload your designs%{lineOneEnd} or %{linkStart}click to upload%{linkEnd}."
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"
msgstr ""
......@@ -7458,6 +7461,9 @@ msgstr ""
msgid "Enable SAML authentication for this group"
msgstr ""
msgid "Enable Seat Link"
msgstr ""
msgid "Enable access to Grafana"
msgstr ""
......@@ -7500,6 +7506,9 @@ msgstr ""
msgid "Enable mirror configuration"
msgstr ""
msgid "Enable or disable Seat Link."
msgstr ""
msgid "Enable or disable keyboard shortcuts"
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}."
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)"
msgstr ""
......@@ -17543,6 +17555,12 @@ msgid_plural "SearchResults|wiki results"
msgstr[0] ""
msgstr[1] ""
msgid "Seat Link"
msgstr ""
msgid "Seat Link is disabled, and cannot be configured through this form."
msgstr ""
msgid "Seats currently in use"
msgstr ""
......@@ -21101,6 +21119,9 @@ msgstr ""
msgid "To set up this service:"
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."
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