Commit d9d56007 authored by Shinya Maeda's avatar Shinya Maeda

Make membership required for create_user_by_membership

parent af129038
......@@ -25,6 +25,8 @@ module AccessMatchersForController
user = role
sign_in(user)
when *Gitlab::Access.sym_options_with_owner.keys # owner, master, developer, reporter, guest
raise ArgumentError, "cannot emulate #{role} without membership parent" unless membership
user = create_user_by_membership(role, membership)
sign_in(user)
else
......@@ -34,9 +36,7 @@ module AccessMatchersForController
user
end
def create_user_by_membership(role, membership = nil)
raise ArgumentError, "cannot emulate #{role} without membership parent" unless membership
def create_user_by_membership(role, membership)
if role == :owner && membership.owner
user = membership.owner
else
......
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