debian-mirror-gitlab/app/models/members/member_role.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
450 B
Ruby
Raw Normal View History

2022-08-27 11:52:29 +05:30
# frozen_string_literal: true
class MemberRole < ApplicationRecord # rubocop:disable Gitlab/NamespacedClass
has_many :members
belongs_to :namespace
2022-11-25 23:54:43 +05:30
validates :namespace, presence: true
2022-08-27 11:52:29 +05:30
validates :base_access_level, presence: true
2022-11-25 23:54:43 +05:30
validate :belongs_to_top_level_namespace
private
def belongs_to_top_level_namespace
return if !namespace || namespace.root?
errors.add(:namespace, s_("must be top-level namespace"))
end
2022-08-27 11:52:29 +05:30
end