Class: Groups::GroupLinks::UpdateService

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

Constant Summary

Constants inherited from BaseService

BaseService::UnauthorizedError

Instance Attribute Summary

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, #visibility_level

Methods included from Gitlab::Allowable

#can?, #can_all?, #can_any?

Constructor Details

#initialize(group_link, user = nil) ⇒ UpdateService

Returns a new instance of UpdateService.



6
7
8
9
10
# File 'app/services/groups/group_links/update_service.rb', line 6

def initialize(group_link, user = nil)
  super(group_link.shared_group, user)

  @group_link = group_link
end

Instance Method Details

#execute(group_link_params) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/services/groups/group_links/update_service.rb', line 12

def execute(group_link_params)
  @group_link_params = group_link_params

  remove_unallowed_params

  group_link.update!(group_link_params)

  if requires_authorization_refresh?(group_link_params)
    shared_with_group = group_link.shared_with_group

    AuthorizedProjectUpdate::EnqueueGroupMembersRefreshAuthorizedProjectsWorker.perform_async(
      shared_with_group.id,
      { 'priority' => priority_for_refresh.to_s, 'direct_members_only' => true }
    )
  end

  group_link
end