Class: Groups::NestedCreateService

Inherits:
BaseService show all
Defined in:
app/services/groups/nested_create_service.rb

Instance Attribute Summary collapse

Attributes inherited from BaseService

#current_user, #group, #params

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

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(user, params) ⇒ NestedCreateService

Returns a new instance of NestedCreateService.



7
8
9
10
11
12
13
# File 'app/services/groups/nested_create_service.rb', line 7

def initialize(user, params)
  @current_user = user
  @params = params.dup
  @group_path = @params.delete(:group_path)
  @visibility_level = @params.delete(:visibility_level) ||
    Gitlab::CurrentSettings.current_application_settings.default_group_visibility
end

Instance Attribute Details

#group_pathObject (readonly)

Returns the value of attribute group_path.



5
6
7
# File 'app/services/groups/nested_create_service.rb', line 5

def group_path
  @group_path
end

#visibility_levelObject (readonly)

Returns the value of attribute visibility_level.



5
6
7
# File 'app/services/groups/nested_create_service.rb', line 5

def visibility_level
  @visibility_level
end

Instance Method Details

#executeObject



15
16
17
18
19
20
21
22
23
# File 'app/services/groups/nested_create_service.rb', line 15

def execute
  return unless group_path

  if namespace = namespace_or_group(group_path)
    return namespace
  end

  create_group_path
end