2018-07-25 09:30:33 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-03-15 22:29:07 +00:00
|
|
|
class ProtectedTag < ActiveRecord::Base
|
|
|
|
include Gitlab::ShellAdapter
|
2017-04-03 14:17:24 +00:00
|
|
|
include ProtectedRef
|
2017-03-15 22:29:07 +00:00
|
|
|
|
2017-05-05 15:59:31 +00:00
|
|
|
protected_ref_access_levels :create
|
2017-04-03 17:59:58 +00:00
|
|
|
|
|
|
|
def self.protected?(project, ref_name)
|
2017-11-28 15:50:44 +00:00
|
|
|
refs = project.protected_tags.select(:name)
|
|
|
|
|
|
|
|
self.matching(ref_name, protected_refs: refs).present?
|
2017-04-03 17:59:58 +00:00
|
|
|
end
|
2017-03-15 22:29:07 +00:00
|
|
|
end
|