summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-02-04 04:25:07 +0000
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-02-04 04:25:07 +0000
commita8b4756f2925da0e5ca599a8469fe47445c95425 (patch)
tree8b28c3ba5c3a0f45895a284d8be110b918bd7ff8 /lib
parent0bcd5ca4ebfe4901aab8a74f58d0599883f709bd (diff)
parent490cf7bfcefdb2e275c537699717c12e440f57ec (diff)
downloadgitlab-ce-a8b4756f2925da0e5ca599a8469fe47445c95425.tar.gz
Merge branch 'mwessel/gitlab-ce-configure-protection' into 'master'
Mwessel/gitlab ce configure protection See merge request !1467
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/access.rb17
-rw-r--r--lib/gitlab/current_settings.rb1
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/gitlab/access.rb b/lib/gitlab/access.rb
index 411b2b9a3cc..424541b4a04 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,18 @@ module Gitlab
master: MASTER,
}
end
+
+ def protection_options
+ {
+ "Not protected, developers and masters can (force) push and delete the branch" => PROTECTION_NONE,
+ "Partially protected, developers can also push but prevent all force pushes and deletion" => PROTECTION_DEV_CAN_PUSH,
+ "Fully protected, only masters can push and prevent all force pushes and deletion" => 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..93e7edf508c 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'],