Commit 6aa9c21a authored by James Lopez's avatar James Lopez

fix issue with adding members to project (spotted by test)

parent de990aa1
......@@ -81,13 +81,22 @@ class Member < ActiveRecord::Base
member = members.build
member.invite_email = user
end
if !current_user || current_user.can?(:update_group_member, member)
project = members.first.respond_to?(:project)? members.first.project : nil
if can_update_member?(current_user, member, project)
member.created_by ||= current_user
member.access_level = access_level
member.save
end
end
private
def can_update_member?(current_user, member, project)
!current_user || current_user.can?(:update_group_member, member) ||
(project && current_user.can?(:admin_project_member, project))
end
end
def invite?
......
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