Class: Users::SignupService

Inherits:
BaseService show all
Defined in:
app/services/users/signup_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(current_user, params = {}) ⇒ SignupService

Returns a new instance of SignupService.


5
6
7
8
# File 'app/services/users/signup_service.rb', line 5

def initialize(current_user, params = {})
  @user = current_user
  @params = params.dup
end

Instance Method Details

#executeObject


10
11
12
13
14
15
16
17
18
19
# File 'app/services/users/signup_service.rb', line 10

def execute
  assign_attributes
  inject_validators

  if @user.save
    success
  else
    error(@user.errors.full_messages.join('. '))
  end
end