Commit c66c30c8 authored by gitlabhq's avatar gitlabhq

Add check to ensure that a team member has atleast one Access Role selected

parent c7ccfb9a
...@@ -9,7 +9,8 @@ class UsersProject < ActiveRecord::Base ...@@ -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 ...@@ -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
# #
......
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