Add check to ensure that a team member has atleast one Access Role selected
This commit is contained in:
parent
c7ccfb9a9d
commit
c66c30c821
1 changed files with 6 additions and 1 deletions
|
@ -9,7 +9,8 @@ class UsersProject < ActiveRecord::Base
|
||||||
validates_uniqueness_of :user_id, :scope => [:project_id]
|
validates_uniqueness_of :user_id, :scope => [:project_id]
|
||||||
validates_presence_of :user_id
|
validates_presence_of :user_id
|
||||||
validates_presence_of :project_id
|
validates_presence_of :project_id
|
||||||
|
validate :user_has_a_role_selected
|
||||||
|
|
||||||
delegate :name, :email, :to => :user, :prefix => true
|
delegate :name, :email, :to => :user, :prefix => true
|
||||||
|
|
||||||
def update_gitosis_project
|
def update_gitosis_project
|
||||||
|
@ -18,6 +19,10 @@ class UsersProject < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def user_has_a_role_selected
|
||||||
|
errors.add(:base, "Please choose at least one Role in the Access list") unless read || write || admin
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue