Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/protected_branches/update_service.rb')
-rw-r--r--app/services/protected_branches/update_service.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/services/protected_branches/update_service.rb b/app/services/protected_branches/update_service.rb
new file mode 100644
index 00000000000..ed59b06b79a
--- /dev/null
+++ b/app/services/protected_branches/update_service.rb
@@ -0,0 +1,21 @@
+module ProtectedBranches
+ class UpdateService < BaseService
+ attr_reader :protected_branch
+
+ def initialize(project, current_user, id, params = {})
+ super(project, current_user, params)
+ @id = id
+ end
+
+ def execute
+ ProtectedBranch.transaction do
+ @protected_branch = ProtectedBranch.find(@id)
+ set_access_levels!
+ end
+
+ true
+ rescue ActiveRecord::RecordInvalid
+ false
+ end
+ end
+end