summaryrefslogtreecommitdiff
path: root/app/models/member.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-01-22 18:01:38 +0100
committerJames Lopez <james@jameslopez.es>2016-01-22 18:01:38 +0100
commit3d81f1da6e9a0b7370c3318a9f7851af88918ace (patch)
tree0265dc26079da9975184de44d9b28bfb9bd9d357 /app/models/member.rb
parentba07a4c96a90a0cbe81ae7e987f32cc8eac20323 (diff)
parent0e51ca7c4841bb388c0decb57ecc64af86c77805 (diff)
downloadgitlab-ce-3d81f1da6e9a0b7370c3318a9f7851af88918ace.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into update-ruby-2.2.4
# Conflicts: # .gitlab-ci.yml
Diffstat (limited to 'app/models/member.rb')
-rw-r--r--app/models/member.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/member.rb b/app/models/member.rb
index 28aee2e3799..34efcd0088d 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -91,7 +91,7 @@ class Member < ActiveRecord::Base
member.invite_email = user
end
- if can_update_member?(current_user, member)
+ if can_update_member?(current_user, member) || project_creator?(member, access_level)
member.created_by ||= current_user
member.access_level = access_level
@@ -107,6 +107,11 @@ class Member < ActiveRecord::Base
current_user.can?(:update_group_member, member) ||
current_user.can?(:update_project_member, member)
end
+
+ def project_creator?(member, access_level)
+ member.new_record? && member.owner? &&
+ access_level.to_i == ProjectMember::MASTER
+ end
end
def invite?