2018-06-27 16:20:23 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-12-07 21:17:24 +00:00
|
|
|
# NamespaceNameValidator
|
|
|
|
#
|
|
|
|
# Custom validator for GitLab namespace name strings.
|
|
|
|
class NamespaceNameValidator < ActiveModel::EachValidator
|
|
|
|
def validate_each(record, attribute, value)
|
|
|
|
unless value =~ Gitlab::Regex.namespace_name_regex
|
|
|
|
record.errors.add(attribute, Gitlab::Regex.namespace_name_regex_message)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|