2018-07-18 12:03:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-24 07:05:04 -04:00
|
|
|
module ProtectedBranches
|
|
|
|
class DestroyService < BaseService
|
|
|
|
def execute(protected_branch)
|
2018-03-24 20:54:56 -04:00
|
|
|
raise Gitlab::Access::AccessDeniedError unless can?(current_user, :destroy_protected_branch, protected_branch)
|
|
|
|
|
2018-03-24 07:05:04 -04:00
|
|
|
protected_branch.destroy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-09-17 08:06:48 -04:00
|
|
|
|
|
|
|
ProtectedBranches::DestroyService.prepend_if_ee('EE::ProtectedBranches::DestroyService')
|