diff options
author | Marco Wessel <marco@poop.nl> | 2015-01-25 18:33:54 +0300 |
---|---|---|
committer | Marco Wessel <marco@poop.nl> | 2015-01-25 19:09:10 +0300 |
commit | aad6ceaef9ccfba8e058012a0877b80c103a3838 (patch) | |
tree | 33042a755f2c35024c140f20e9d63aba7e450ff4 /lib | |
parent | 254d1d7aa07fd1b45dd4090e98bcba86f5d3c699 (diff) |
Allow configuring protection of the default branch upon first push
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/access.rb | 16 | ||||
-rw-r--r-- | lib/gitlab/current_settings.rb | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/gitlab/access.rb b/lib/gitlab/access.rb index 411b2b9a3cc..ad05bfadafe 100644 --- a/lib/gitlab/access.rb +++ b/lib/gitlab/access.rb @@ -11,6 +11,11 @@ module Gitlab MASTER = 40 OWNER = 50 + # Branch protection settings + PROTECTION_NONE = 0 + PROTECTION_DEV_CAN_PUSH = 1 + PROTECTION_FULL = 2 + class << self def values options.values @@ -43,6 +48,17 @@ module Gitlab master: MASTER, } end + + def protection_options + { + "None" => PROTECTION_NONE, + "Protect, developers can push" => PROTECTION_DEV_CAN_PUSH, + "Full protection" => PROTECTION_FULL, + } + end + def protection_values + protection_options.values + end end def human_access diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb index 2c5660df373..75afc024a62 100644 --- a/lib/gitlab/current_settings.rb +++ b/lib/gitlab/current_settings.rb @@ -12,6 +12,7 @@ module Gitlab def fake_application_settings OpenStruct.new( default_projects_limit: Settings.gitlab['default_projects_limit'], + default_branch_protection: Settings.gitlab['default_branch_protection'], signup_enabled: Settings.gitlab['signup_enabled'], signin_enabled: Settings.gitlab['signin_enabled'], gravatar_enabled: Settings.gravatar['enabled'], |