gitlab-org--gitlab-foss/app/services/members/create_service.rb
Dmitriy Zaporozhets 7de75920f7
Refactor controller code that creates project/group members
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2017-04-17 14:45:14 +03:00

22 lines
467 B
Ruby

module Members
class CreateService < BaseService
def initialize(source, current_user, params = {})
@source = source
@current_user = current_user
@params = params
end
def execute
return false if params[:user_ids].blank?
@source.add_users(
params[:user_ids].split(','),
params[:access_level],
expires_at: params[:expires_at],
current_user: current_user
)
true
end
end
end