gitlab-org--gitlab-foss/app/validators/top_level_group_validator.rb

8 lines
210 B
Ruby
Raw Normal View History

class TopLevelGroupValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
if value&.subgroup?
record.errors.add(attribute, "must be a top level Group")
end
end
end