gitlab-org--gitlab-foss/app/validators/top_level_group_validator.rb
James Edwards-Jones 590ddfdcba Adds validators and rack cookie helper
These changes are backported from EE, related to SAML settings in
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/4549
2018-04-02 14:39:32 +01:00

7 lines
210 B
Ruby

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