Skip to content

Commit

Permalink
Merge pull request #17197 from hstastna/Duplicate_RBAC_Role_Group_nam…
Browse files Browse the repository at this point in the history
…es_capitalization

Add case insensitivity when validating uniqueness of name of new group/role
(cherry picked from commit ad57f99)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1561076
  • Loading branch information
bdunne authored and simaishi committed Mar 27, 2018
1 parent 3e48743 commit 5e8f0c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/miq_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MiqGroup < ApplicationRecord

delegate :self_service?, :limited_self_service?, :disallowed_roles, :to => :miq_user_role, :allow_nil => true

validates :description, :presence => true, :unique_within_region => true
validates :description, :presence => true, :unique_within_region => { :match_case => false }
validate :validate_default_tenant, :on => :update, :if => :tenant_id_changed?
before_destroy :ensure_can_be_destroyed
after_destroy :reset_current_group_for_users
Expand Down
3 changes: 1 addition & 2 deletions app/models/miq_user_role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class MiqUserRole < ApplicationRecord

virtual_column :vm_restriction, :type => :string

validates_presence_of :name
validates_uniqueness_of :name
validates :name, :presence => true, :uniqueness => { :case_sensitive => false }

serialize :settings

Expand Down

0 comments on commit 5e8f0c4

Please sign in to comment.