summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-05-09 20:40:19 +0100
committerSean McGivern <sean@gitlab.com>2017-05-11 09:20:11 +0100
commit3c546acf78408087b5062be67ae6b05650e0f27e (patch)
tree0ac538aa9b0786dbac0317693dafa47cf8d01012 /app
parent4067dd4f84681dd109fb8e1957b6327b4db20193 (diff)
downloadgitlab-ce-3c546acf78408087b5062be67ae6b05650e0f27e.tar.gz
Allow disabling usage ping in `gitlab.yml`
Setting `usage_ping_enabled` to false in `gitlab.yml`: 1. Disables the usage ping, regardless of the value stored in the database. 2. Prevents the usage ping from being enabled through the admin panel. It can only be enabled by either removing the line from `gitlab.yml` and configuring through the admin panel, or setting it to true in `gitlab.yml`.
Diffstat (limited to 'app')
-rw-r--r--app/models/application_setting.rb10
-rw-r--r--app/views/admin/application_settings/_form.html.haml21
2 files changed, 23 insertions, 8 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 54f01f8637e..043f57241a3 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -246,7 +246,7 @@ class ApplicationSetting < ActiveRecord::Base
two_factor_grace_period: 48,
user_default_external: false,
polling_interval_multiplier: 1,
- usage_ping_enabled: true
+ usage_ping_enabled: Settings.gitlab['usage_ping_enabled']
}
end
@@ -349,6 +349,14 @@ class ApplicationSetting < ActiveRecord::Base
sidekiq_throttling_enabled
end
+ def usage_ping_can_be_configured?
+ Settings.gitlab.usage_ping_enabled
+ end
+
+ def usage_ping_enabled
+ usage_ping_can_be_configured? && super
+ end
+
private
def ensure_uuid!
diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml
index 4b6628169ef..e1b4e34cd2b 100644
--- a/app/views/admin/application_settings/_form.html.haml
+++ b/app/views/admin/application_settings/_form.html.haml
@@ -502,17 +502,24 @@
Let GitLab inform you when an update is available.
.form-group
.col-sm-offset-2.col-sm-10
+ - can_be_configured = @application_setting.usage_ping_can_be_configured?
.checkbox
= f.label :usage_ping_enabled do
- = f.check_box :usage_ping_enabled
+ = f.check_box :usage_ping_enabled, disabled: !can_be_configured
Usage ping enabled
- = link_to icon('question-circle'), help_page_path("user/admin_area/settings/usage_statistics", anchor: "usage-data")
+ = link_to icon('question-circle'), help_page_path("user/admin_area/settings/usage_statistics", anchor: "usage-ping")
.help-block
- Every week GitLab will report license usage back to GitLab, Inc.
- Disable this option if you do not want this to occur. To see the
- JSON payload that will be sent, visit the
- = succeed '.' do
- = link_to "Cohorts page", admin_cohorts_path(anchor: 'usage-ping')
+ - if can_be_configured
+ Every week GitLab will report license usage back to GitLab, Inc.
+ Disable this option if you do not want this to occur. To see the
+ JSON payload that will be sent, visit the
+ = succeed '.' do
+ = link_to "Cohorts page", admin_cohorts_path(anchor: 'usage-ping')
+ - else
+ The usage ping is disabled, and cannot be configured through this
+ form. For more information, see the documentation on
+ = succeed '.' do
+ = link_to 'deactivating the usage ping', help_page_path('user/admin_area/settings/usage_statistics', anchor: 'deactivate-the-usage-ping')
%fieldset
%legend Email