From: gitlabhq Date: Thu, 20 Oct 2011 13:48:09 +0000 (-0400) Subject: Add check to ensure that a team member has atleast one Access Role selected X-Git-Tag: v1.2.0pre~102 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=c66c30c821a77309302560667692854b2caabb8d;p=wvm%2Fgitlab.git Add check to ensure that a team member has atleast one Access Role selected --- diff --git a/app/models/users_project.rb b/app/models/users_project.rb index bdc10633a..96e2d16af 100644 --- a/app/models/users_project.rb +++ b/app/models/users_project.rb @@ -9,7 +9,8 @@ class UsersProject < ActiveRecord::Base validates_uniqueness_of :user_id, :scope => [:project_id] validates_presence_of :user_id validates_presence_of :project_id - + validate :user_has_a_role_selected + delegate :name, :email, :to => :user, :prefix => true def update_gitosis_project @@ -18,6 +19,10 @@ class UsersProject < ActiveRecord::Base 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 # == Schema Information #