summaryrefslogtreecommitdiff
path: root/app/services/protected_branches/destroy_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/protected_branches/destroy_service.rb')
-rw-r--r--app/services/protected_branches/destroy_service.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/services/protected_branches/destroy_service.rb b/app/services/protected_branches/destroy_service.rb
new file mode 100644
index 00000000000..8172c896e76
--- /dev/null
+++ b/app/services/protected_branches/destroy_service.rb
@@ -0,0 +1,9 @@
+module ProtectedBranches
+ class DestroyService < BaseService
+ def execute(protected_branch)
+ raise Gitlab::Access::AccessDeniedError unless can?(current_user, :destroy_protected_branch, protected_branch)
+
+ protected_branch.destroy
+ end
+ end
+end