Commit 62b47eef authored by Alejandro Guerrero's avatar Alejandro Guerrero

Strip whitespace from saml_group_name

parent 895dff25
......@@ -5,6 +5,8 @@ class SamlGroupLink < ApplicationRecord
enum access_level: ::Gitlab::Access.options_with_owner
before_validation :strip_whitespace_from_saml_group_name
validates :group, :access_level, presence: true
validates :saml_group_name, presence: true, uniqueness: { scope: [:group_id] }, length: { maximum: 255 }
......@@ -12,4 +14,9 @@ class SamlGroupLink < ApplicationRecord
scope :by_saml_group_name, -> (name) { where(saml_group_name: name) }
scope :by_group_id, ->(group_id) { where(group_id: group_id) }
scope :preload_group, -> { preload(group: :route) }
def strip_whitespace_from_saml_group_name
saml_group_name.strip!
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment