Class: Groups::GroupLinks::DestroyService
- Inherits:
-
BaseService
- Object
- BaseService
- BaseService
- Groups::GroupLinks::DestroyService
- Defined in:
- app/services/groups/group_links/destroy_service.rb
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #group, #params
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
Methods inherited from BaseService
Methods inherited from BaseService
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
Constructor Details
This class inherits a constructor from Groups::BaseService
Instance Method Details
#execute(one_or_more_links, skip_authorization: false) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/services/groups/group_links/destroy_service.rb', line 6 def execute(one_or_more_links, skip_authorization: false) unless || group && can?(current_user, :admin_group_member, group) return error('Not Found', 404) end links = Array(one_or_more_links) if GroupGroupLink.delete(links) Gitlab::AppLogger.info( "GroupGroupLinks with ids: #{links.map(&:id)} have been deleted.") groups_to_refresh = links.map(&:shared_with_group) groups_to_refresh.uniq.each do |group| next if Feature.enabled?(:skip_group_share_unlink_auth_refresh, group.root_ancestor) group.(direct_members_only: true) end else Gitlab::AppLogger.info( "Failed to delete GroupGroupLinks with ids: #{links.map(&:id)}.") end links end |